squirreldev / twig-matrix-match
Adds a Twig filter to match matrix fields handles with templates names
Package info
github.com/tilingue/craft-twig-matrix-match
Type:craft-plugin
pkg:composer/squirreldev/twig-matrix-match
1.1.0
2021-08-04 16:36 UTC
Requires
- craftcms/cms: ^3.0.0-RC1
- twig/extensions: ^1.5
This package is not auto-updated.
Last update: 2026-04-10 13:38:27 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 %}