tiny-pixel/acorn-block-templates

Block templates for Sage 10

Fund package maintenance!
Patreon

Installs: 1 112

Dependents: 0

Suggesters: 0

Security: 0

Stars: 18

Watchers: 5

Forks: 3

Open Issues: 2

Type:package

1.1.0 2020-08-17 10:15 UTC

This package is auto-updated.

Last update: 2024-04-15 15:31:42 UTC


README

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.