How can I display the field contained inside the tab that was active on save (and not the other tab)?

by lcunning   Last Updated April 19, 2018 16:07 PM

I have a content type with a paragraph that has two fields, each field inside its own tab controlled by the form display like so:

showing tabbed form display

Here is what the set of tabbed fields looks like when editing a piece of content of the content type:

single tab display on content edit

multi tab display on content edit

I'm using a custom paragraph template banner_header to control the display of the paragraph:

{% if field_active_callout_tab == 'Single' %}
    <a href="{{ content.field_callout_link.0['#url'] }}">
           <div class="callout-wrapper-inner">
                 {{ content.field_callout_icon }}
                 {{ content.field_callout_text }}
           </div>
    </a>
    {% if content.field_small_callout_button_link.0 %}
           <div style="visibility: hidden;">
                 {{content.field_small_callout_button_link.0}}
           </div>
    {% endif %}
{% else %}
    <a href="{{ content.field_small_callout_button_link.0['#url'] }}"></a>
    {% if content.field_callout_link.0 %}
          <div style="visibility: hidden;">
                 {{content.field_callout_link.0}}
          </div>
          <div class="callout-wrapper-inner" style="visibility: hidden;">
                 {{ content.field_callout_icon }}
                 {{ content.field_callout_text }}
          </div>
    {% endif %}
{% endif %}  

The code I have above does not work, regardless of the tab that is active on save. Only the field field_callout_link (in the Single tab) prints.

How can I print the field from inside the tab that was active on save (and not the other tab field?)



Answers 1


What is the HTML output of this field on your front end?

Isaiah Nixon
Isaiah Nixon
April 19, 2018 15:37 PM

Related Questions





Specific Site Building Setup

Updated March 07, 2018 20:07 PM