Magento CMS content supports placeholders in double curly braces, for example to insert variables, translated texts or loops over lists. Some combinations do not work in standard Magento: a condition inside a loop, or a placeholder inside the setting of a widget, which itself is written in curly braces. This module extends the template processing of CMS pages and blocks on the storefront so that such templates can be written. It is mainly used by other Infrangible modules that render CMS blocks as templates, for example “Retail Store”, which fills store detail pages and search results from CMS blocks.
Features
- Conditions inside loops: within a loop, a special condition block with an optional “else” part can check a value of the current list entry, for example to show the “Special Opening Hours” heading only for stores that have special opening hours.
- Loops work with the current list entry as a full set of values, including a running index.
- Short variable placeholders written between hash characters, which can be used where curly braces are not possible, for example inside the info window text of a map widget.
- Short translation placeholders written between hash characters, translated into the language of the current store view.
- A “filter” modifier for variables: the inserted value is processed again, so placeholders contained in the value itself are resolved as well.
Configuration
There is nothing to configure. The extended syntax is available right after installation.
Good to know
This module is a building block. It is installed automatically with “Retail Store”. Merchants normally do not install it on its own, but agencies can use the extended syntax in their own CMS templates.
Installation
Install the module with Composer in your Magento root directory:
composer require infrangible/m2-cms-filterThen enable it and update the store as described in the installation guide. Composer installs the required modules listed on this page automatically.