Skip to content

Easily override Gutenberg block markup with Blade templates in Sage 10.

License

Notifications You must be signed in to change notification settings

pixelcollective/acorn-block-templates

Repository files navigation

Acorn Block Templates

Easily override block markup with Blade templates in Sage 10.

Requirements

Installation

Install via Composer:

$ composer require tiny-pixel/acorn-block-templates

Usage

Create a blocks directory in resources/views. Templates should be named after the block they target and should be placed within a directory with a name matching the block's namespace.

Example

├── blocks
    └── core
        ├── gallery.blade.php     # core/gallery
        ├── image.blade.php       # core/image
        └── paragraph.blade.php   # core/paragraph

The template is passed two variables: $attr and $content.

  • $attr is an array of the block's attributes.
  • $content is a string of the block's output.

In this way you can override the template for any block, regardless of if it is registered by core or a plugin. You can use Composers, extends, or any other feature afforded to you by Sage, Illuminate or other packages.

Contributing

Contributing, whether it be through PRs, reporting an issue, or suggesting an idea is encouraged and appreciated.

All contributors absolutely must strictly adhere to our Code of Conduct.

License

This project is provided under the MIT License.

About

Easily override Gutenberg block markup with Blade templates in Sage 10.

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages