{"id":15472903,"url":"https://github.com/kellymears/block-sandbox","last_synced_at":"2025-03-03T17:31:18.478Z","repository":{"id":57070140,"uuid":"184239003","full_name":"kellymears/block-sandbox","owner":"kellymears","description":"Better WordPress block testing for theme \u0026 plugin developers.","archived":true,"fork":false,"pushed_at":"2020-05-14T10:22:53.000Z","size":288,"stargazers_count":7,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-23T13:37:35.448Z","etag":null,"topics":["gutenberg","wordpress","wordpress-plugin"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kellymears.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-30T10:05:53.000Z","updated_at":"2024-12-31T16:43:34.000Z","dependencies_parsed_at":"2022-08-24T14:54:20.802Z","dependency_job_id":null,"html_url":"https://github.com/kellymears/block-sandbox","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kellymears%2Fblock-sandbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kellymears%2Fblock-sandbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kellymears%2Fblock-sandbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kellymears%2Fblock-sandbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kellymears","download_url":"https://codeload.github.com/kellymears/block-sandbox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241709336,"owners_count":20007050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gutenberg","wordpress","wordpress-plugin"],"created_at":"2024-10-02T02:41:39.884Z","updated_at":"2025-03-03T17:31:18.218Z","avatar_url":"https://github.com/kellymears.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Block Editor Sandbox\n\n[![Latest Stable Version](https://poser.pugx.org/tiny-pixel/block-sandbox/v/stable)](https://packagist.org/packages/tiny-pixel/block-sandbox) [![Total Downloads](https://poser.pugx.org/tiny-pixel/block-sandbox/downloads)](https://packagist.org/packages/tiny-pixel/block-sandbox) [![License](https://poser.pugx.org/tiny-pixel/block-sandbox/license)](https://packagist.org/packages/tiny-pixel/block-sandbox)\n\nThis plugin registers a `Sandbox` posttype preset with a template including many common/core blocks in diverse arrangements. It requires zero configuration to start utilizing.\n\nIt was inspired by `coblocks/block-unit-test` (now `godaddy/block-unit-test` 😬).\n\n**In comparison, `block-sandbox` aims to be:**\n\n✅ Hackable, with an easy-to-read and fun-to-modify API\n\n✅ Easy to keep updated as the block spec continues to change\n\n✅ Not the intellectual property of Godaddy. Nothing against Rich Tabor (get it!) but _no, thanks_.\n\n## Simple usage\n\n```console\n$ composer require tiny-pixel/block-sandbox\n$ wp plugin activate block-sandbox\n```\n\n## Programmatic usage \u0026 configuration\n\nAt a minimum you need to create the CPT, apply the template and register it with WordPress:\n\n```php\nadd_action('init', function () {\n    (new Sandbox())\n        -\u003ecreate()\n        -\u003eapplyTemplate()\n        -\u003eregister();\n});\n```\n\nAdditionally, there are several methods available for you to utilize in modifying the behavior of the plugin.\n\n### Append extra blocks\n\nIf you would like to add additional blocks to the template you can do so with the `appendBlocks` method.\n\n```php\n$extra = [['core/cover', [\n    'align'   =\u003e 'wide',\n    'url'     =\u003e 'example.png',\n    'title'   =\u003e 'Additional block'\n]]];\n\nadd_action('init', function () use ($extra) {\n    (new Sandbox())\n        -\u003ecreateSandbox()\n        -\u003eappendBlocks($extra)\n        -\u003eapplyTemplate()\n        -\u003eregister();\n});\n```\n\n### Overwrite template\n\nIf you would like to wholesale replace the included template with your own you can do so using `setTemplate`. Just pass in an array of the blocks.\n\n```php\n$template = [\n  ['core/cover', [\n    'align'   =\u003e 'wide',\n    'url'     =\u003e 'example.png',\n    'title'   =\u003e 'Additional block']],\n\n  ['core-embed/vimeo', [\n    'caption' =\u003e '\u003cem\u003eécoute: El Guincho\u003c/em\u003e',\n    'align'   =\u003e 'wide',\n    'url'     =\u003e 'https://vimeo.com/70237487']],\n];\n\nadd_action('init', function () use ($template) {\n    (new Sandbox())\n        -\u003ecreateSandbox()\n        -\u003esetTemplate($template)\n        -\u003eapplyTemplate()\n        -\u003eregister();\n});\n```\n\n### Modify labels\n\nIf you would like to change `sandbox` to something else you can do that using `setLabel`. It takes an array with a new `id`, `singular`, and `plural` form of your desired label.\n\n```php\n$label = [\n  'id'       =\u003e 'test',\n  'singular' =\u003e 'Test',\n  'plural'   =\u003e 'Tests',\n];\n\nadd_action('init', function () use ($label) {\n    (new Sandbox())\n        -\u003ecreate()\n        -\u003esetLabel($label)\n        -\u003eapplyTemplate()\n        -\u003eregister();\n});\n```\n\n### All of the above\n\n```php\nadd_action('init', function () use ($template, $extra, $posttype) {\n    (new Sandbox())\n        -\u003ecreate()\n        -\u003esetLabel($posttype)\n        -\u003esetTemplate($template)\n        -\u003eappendBlocks($extra)\n        -\u003eapplyTemplate()\n        -\u003eregister();\n});\n```\n\n## License\n\n[MIT License](https://github.com/kellymears/block-testing/blob/master/LICENSE.md). Happy hacking!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkellymears%2Fblock-sandbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkellymears%2Fblock-sandbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkellymears%2Fblock-sandbox/lists"}