It is possible to add custom fields to the Content Constructor components per project and almost all Content Constructor components. This feature allows adding new configuration fields, which can be saved in Component configuration and read later within the templates to develop custom functionalities.
There are many types of fields that are supported. They will be listed and described in detail at the end of this document.
Adding a custom field to Image Teaser slide configurator
To add a custom field to your project, view.xml file of your-theme needs to be edited.
Variables set for MageSuite_ContentConstructor module needs to be created, and
<vars module="MageSuite_ContentConstructor"> <var name="teaser"> <var name="tabs"> <var name="2"> <var name="label">badge</var> <var name="content"> <var name="fields"> <var name="0"> <var name="label">Badge text</var> <var name="type">textarea</var> <var name="model">badge_text</var> <var name="hint"><![CDATA[ Add content with special markup, e.g.:<br> - <small>Only</small> {{price sku="some_sku"}}<br> - {{sku sku="some_sku"}}<br> - <big>Only</big> {{qty sku="some_sku"}} left ]]></var> </var> <var name="1"> <var name="label">Badge align</var> <var name="type">position</var> <var name="model">badge_align</var> <var name="rows">3</var> <var name="columns">3</var> <var name="default"> <var name="x">1</var> <var name="y">1</var> </var> <var name="warning">Note: Please verify text position configuration in the "Content" tab. It might overlap the badge position.</var> </var> </var> </var> </var> </var> </var> </vars>
Implementation examples
To have a full overview of adding configuration fields and using them in overwritten component templates later, let's create 2 custom features.
Let's say core team and PO decided to not implement any of the things your client needs into the core. This is where we need to use the custom fields feature.
For both our tasks our project is called Minisoft so our theme is theme-minisoft.
Example 1
Client needs to display price of the product, he puts into image teaser and additionally he wants to select its position among 9 predefined, exactly the way text content is positioned.
Types of custom felds
Below Table contains a list of all types of fields/component you can be used in the project.