{"id":18771035,"url":"https://github.com/rareloop/pebble-acf-blocks","last_synced_at":"2025-06-13T10:09:43.956Z","repository":{"id":62533326,"uuid":"252767042","full_name":"Rareloop/pebble-acf-blocks","owner":"Rareloop","description":null,"archived":false,"fork":false,"pushed_at":"2020-04-28T15:50:15.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-13T10:09:29.479Z","etag":null,"topics":[],"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/Rareloop.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":"2020-04-03T15:12:07.000Z","updated_at":"2020-04-28T15:50:18.000Z","dependencies_parsed_at":"2022-11-02T15:00:54.358Z","dependency_job_id":null,"html_url":"https://github.com/Rareloop/pebble-acf-blocks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Rareloop/pebble-acf-blocks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rareloop%2Fpebble-acf-blocks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rareloop%2Fpebble-acf-blocks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rareloop%2Fpebble-acf-blocks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rareloop%2Fpebble-acf-blocks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rareloop","download_url":"https://codeload.github.com/Rareloop/pebble-acf-blocks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rareloop%2Fpebble-acf-blocks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259624736,"owners_count":22886330,"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":[],"created_at":"2024-11-07T19:22:56.703Z","updated_at":"2025-06-13T10:09:43.921Z","avatar_url":"https://github.com/Rareloop.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ACF Blocks for Pebble (Lumberjack \u0026 Primer)\n\nThis package provides a way to create [ACF Blocks](https://www.advancedcustomfields.com/resources/blocks/) that use Twig templates and simultaneously integrate with both Lumberjack and Primer.\n\n## Installation\n\n`composer require rareloop/pebble-acf-blocks`\n\nOnce installed, register the Service Provider in config/app.php:\n\n```php\n'providers' =\u003e [\n    ...\n\n    Rareloop\\Lumberjack\\AcfBlocks\\AcfBlocksProvider::class,\n\n    ...\n],\n```\n\nCopy the example `config/acfblocks.php` file to you theme directory.\n\n## Usage\n\nTo create a block, first create a child of the `AcfBlock`. This should sit in the same folder as your Primer component, for example `blocks/my-block`. The name of the class should also be the Upper Camel Case version of the folder name, in our case `MyBlock`.\n\n_Note: Pebble maps the namespace `\\Patterns` to the directory `my-theme/resources/patterns`_\n\n```php\n\u003c?php\n\nnamespace Patterns\\Blocks\\MyBlock;\n\nuse Rareloop\\Lumberjack\\AcfBlocks\\AcfBlock;\n\nclass MyBlock extends AcfBlock\n{\n    /**\n     * Provide the data to pass to the template\n     *\n     * @return array\n     */\n    public function context(): array\n    {\n        return [\n            'name' =\u003e get_field('test_field'),\n        ];\n    }\n\n    /**\n     * Provide the config required to register this block\n     * https://www.advancedcustomfields.com/resources/acf_register_block_type/\n     *\n     * @return array\n     */\n    public static function blockConfig(): array\n    {\n        return [\n            'name'              =\u003e 'mytestblock',\n            'title'             =\u003e __('Test Block'),\n            'description'       =\u003e __('A first go with a block.'),\n            'category'          =\u003e 'formatting',\n            'icon'              =\u003e 'admin-comments',\n            'keywords'          =\u003e ['testimonial', 'quote'],\n        ];\n    }\n}\n```\n\nThe `blockConfig()` function is what ACF uses to register the block with WordPress. For more configuration options please see the [ACF documentation](https://www.advancedcustomfields.com/resources/acf_register_block_type/).\n\nThe `context()` function is where you provide the data for your patterns `template.twig` file when used in WordPress. Within this function, all calls to `get_field()` will be scoped to the current Gutenberg block, as is the case with other ACF Blocks.\n\nThe final step is to add the class to your `config/acfblocks.php` file:\n\n```php\n\u003c?php\n\nreturn [\n    'blocks' =\u003e [\n        \\Patterns\\Blocks\\MyBlock\\MyBlock::class,\n    ]\n];\n```\n\n### Additional Parameters\n\nYou have access to the following additional parameters from within your ACF class:\n\n- `$this-\u003econtent` - The block inner HTML (empty)\n- `$this-\u003eisPreview` - Whether or not the block is being shown in preview\n- `$this-\u003epostId` - The ID of the post that the block is attached to\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frareloop%2Fpebble-acf-blocks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frareloop%2Fpebble-acf-blocks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frareloop%2Fpebble-acf-blocks/lists"}