CMS Development

MrCapp
Contributeur

How to pass data to a nested group in a custom module in a template?

Résolue

Hello. I'm hoping someone can shed some light on this.

 

I have a template with a series of custom modules and I'm trying to replace the default content in some of the fields with content specific to the type of template.

 

In this example I have a field for the heading and field for the copy - both are Rich Text. These are contained in the Text Settings group for the module. How can I set different text for those fields?

 

I've tried the code below but can only get one field or the other working, but not both. What am I missing? Thanks.

 

{% dnd_section %}
    {% dnd_column %}
      {% dnd_row %}
        {% dnd_module path="../modules/Text Row with Image"%}
        {% module_attribute "text_settings" %}{ heading: "<h2>Intro Header</h2>" }{% end_module_attribute %}
        {% module_attribute "text_settings" %}{ copy: "<p>My Lorem ipsum dolor sit amet.</p>" }{% end_module_attribute %}
        {% end_dnd_module %}
      {% end_dnd_row %}
    {% end_dnd_column %}
  {% end_dnd_section %}

 

0 Votes
1 Solution acceptée
MrCapp
Solution
Contributeur

How to pass data to a nested group in a custom module in a template?

Résolue

Finally got it sorted - revised code below if anyone else has a similar issue:

{% dnd_section %}
    {% dnd_column %}
      {% dnd_row %}
        {% dnd_module path="../modules/Text Row with Image"%}
        {% module_attribute "text_settings" %}
          { 
            heading: "<h2>Intro Header</h2>", 
            copy: "<p>My Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>"
          }
        {% end_module_attribute %}
        {% end_dnd_module %}
      {% end_dnd_row %}
    {% end_dnd_column %}
  {% end_dnd_section %}

 

Voir la solution dans l'envoi d'origine

0 Votes
1 Réponse
MrCapp
Solution
Contributeur

How to pass data to a nested group in a custom module in a template?

Résolue

Finally got it sorted - revised code below if anyone else has a similar issue:

{% dnd_section %}
    {% dnd_column %}
      {% dnd_row %}
        {% dnd_module path="../modules/Text Row with Image"%}
        {% module_attribute "text_settings" %}
          { 
            heading: "<h2>Intro Header</h2>", 
            copy: "<p>My Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>"
          }
        {% end_module_attribute %}
        {% end_dnd_module %}
      {% end_dnd_row %}
    {% end_dnd_column %}
  {% end_dnd_section %}

 

0 Votes