{% set isPersonalized = isPersonalized|default("") and isPersonalized == true ? true : false %}
{% for feature in features %} {% if isPersonalized %} {% set isFlipped = loop.index is even %} {% set review = null %} {% set ctas = [] %} {% if feature.rating %} {% set review = { rating: feature.rating.stars, text: feature.rating.text } %} {% endif %} {% if feature.cta %} {% set cta = { text: feature.cta.text, href: feature.cta.href } %} {% set ctas = ctas|merge([cta]) %} {% endif %} {% include "@views/modules/heroes/default/template.twig" with { eyebrow: feature.eyebrow, heading: feature.heading, headingTag: 'h2', paragraph: feature.paragraph, media: feature.media, ctaPrimary: ctas[0], ctaSecondary: null, review: review, isFlipped: isFlipped, isPersonalized: isPersonalized } %} {% else %} {% if feature.module_primary_feature %} {% set data = feature.module_primary_feature.primary_feature.meta("post_feature") %} {% else %} {% set data = feature.meta('post_feature') %} {% endif %} {% set review = null %} {% set isFlipped = loop.index is even %} {% set ctas = [] %} {% if data.buttons.button %} {% for button in data.buttons.button %} {% set cta = null %} {% set params = "" %} {% if button.custom_attributes %} {% for attr in button.custom_attributes %} {% set params = params ~ attr.key ~ '="' ~ attr.value ~ '" ' %} {% endfor %} {% endif %} {% if button.action == "link" %} {% set cta = { text: button.link.title, href: button.link.url, target: button.link.target, icon: button.icon.value, params: params, } %} {% elseif button.action == "drawer" %} {% set cta = { text: button.cta, icon: button.icon.value, params: params ~ 'data-shelf-trigger="' ~ button.drawer_id ~ '"' ~ 'data-shelf-content="' ~ button.drawer_data|json_encode()|replace({' ':' '})|replace({'"': '"'}) ~ '"' } %} {% elseif button.action == "anchor" %} {% set cta = { text: button.cta, href: "#" ~ button.anchor_element_id, icon: button.icon.value, params: params, } %} {% endif %} {% set ctas = ctas|merge([cta]) %} {% endfor %} {% endif %} {% set review = { rating: data.rating.stars, text: data.rating.username } %} {% include "@views/modules/heroes/default/template.twig" with { eyebrow: data.eyebrow, heading: data.heading, headingTag: 'h2', paragraph: data.paragraph_text, customStyles: data.custom_styles, media: data.fan, ctaPrimary: ctas[0], ctaSecondary: ctas[1], review: review, isFlipped: isFlipped, isPersonalized: false } %} {% endif %} {% endfor %}