squirreldev / twig-matrix-match
Adds a Twig filter to match matrix fields handles with templates names
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:craft-plugin
Requires
- craftcms/cms: ^3.0.0-RC1
- twig/extensions: ^1.5
This package is not auto-updated.
Last update: 2024-06-07 05:18:24 UTC
README
A very simple plugin to match the matrix fields handles (camel case) with your templates (hypen format).
This plugin will be useful for you to perform a Layout-Builder system using matrix.
After installing this you will be able to do something like this in your entry template to theme up your matrix components:
{% set matrixBlocks = entry.yourMatrix.all() %}
{% for block in matrixBlocks %}
{% set blockType = block.getType().handle %}
{% include '_components/' ~ blockType | camelToHypens ~ '.html' %}
{% endfor %}