Easily override block markup with Blade templates in Sage 10.
Install via Composer:
$ composer require tiny-pixel/acorn-block-templates
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, 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.
This project is provided under the MIT License.