squirreldev/twig-matrix-match

Adds a Twig filter to match matrix fields handles with templates names

1.1.0 2021-08-04 16:36 UTC

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 %}