{% if banner_title is empty %}
    {% set banner_title = p.pagedata['Title Banner'][0] %}
{% endif %}

{% if content is empty %}
    {% set content = banner_title['Content']['value'] %}
{% endif %}

{% if button_link_1 is empty and button_text_1 is empty %}
    {% set button_link_1 = banner_title['Button Link']['value'] %}
    {% set button_text_1 = banner_title['Button Text']['value'] %}

    {% if button_link_1 is empty and button_text_1 is empty %}
        {% set button_link_1 = p.pagedata['Title Banner with image'][0]['Button Link']['value'] %}
        {% set button_text_1 = p.pagedata['Title Banner with image'][0]['Button Text']['value'] %}
    {% endif %}
{% endif %}

{% if button_link_2 is empty and button_text_2 is empty %}
    {% set button_link_2 = banner_title['Button 2 Link']['value'] %}
    {% set button_text_2 = banner_title['Button 2 Text']['value'] %}

    {% if button_link_2 is empty and button_text_2 is empty %}
        {% set button_link_2 = p.pagedata['Title Banner with image'][0]['Button 2 Link']['value'] %}
        {% set button_text_2 = p.pagedata['Title Banner with image'][0]['Button 2 Text']['value'] %}
    {% endif %}
{% endif %}

{% if title is empty %}
    {% set title = banner_title['Title']['value'] %}
{% endif %}

{% if subtitle is empty %}
    {% set subtitle = banner_title['Subtitle']['value'] %}
{% endif %}


<div class="titleWrap {% if dark_background is not empty %}darkBg{% endif %} {% if floating_button  is not empty %}bottomButton{% endif %} {{ class }}">

    <div class="innerText">




        {% if title is not empty %}
            <h1>{{ title|raw }}</h1>
        {% elseif page_meta.page_title is not empty %}
            <h1>{{ page_meta.page_title }}</h1>
        {% endif %}

        {% if subtitle is not empty %}
            <h4>{{ subtitle|raw }}</h4>
        {% endif %}

        {% if icon_points is not empty %}
            <div class="iconHighlights">
                <ul>
                    {% for point in icon_points %}
                        <li>
                            {% if point.icon is not empty %}
                                <i class="icon">
                                    <img 
                                            src="{{ point.icon }}" 
                                            alt="{{ point.text }}" 
                                            width="25" 
                                            height="25"
                                    >
                                </i>
                            {% endif %}
                            {{ point.text | raw }}
                        </li>
                    {% endfor %}
                </ul>

            </div> <!-- .iconPoints -->
        {% endif %}
        
        {% if content %}
            <div class="titleContent wysiwyg">
                {% if raw_content is empty %}
                    <p>{{ content|striptags|raw }}</p>
                {% else %}
                    <p>{{ content|raw }}</p>
                {% endif %}
            </div> <!-- .titleContent -->
        {% endif %}
        

      {% if card_data is not empty %}

            <div class="buttonWrap">
            
                {% if (card_data.actionUrl is not empty and card_data.actionLabel is not empty) or card_data.childCategoryData is not empty  %}
                    
                    
                    {% if card_data.childCategoryData is not empty %}
                        
                        {% for childCat in card_data.childCategoryData %}

                            {% if childCat.actionUrl is not empty and childCat.actionLabel is not empty  %}

                                <a href="{{ childCat.actionUrl }}" class="button {% if alt_button_colors is not empty %} buttonAlt {% endif %} withIcon">
    
                                    {{  childCat.actionLabel }}
    
                                    <i class="svgIcon">
                                        {{ file_get_contents(settings.SITE_PATH ~ settings.THEME_URL ~ '/images/icons/long-arrow-right.svg')|raw }}
                                    </i>
    
                                </a>
                            
                            {% endif %}
                            
                        {% endfor %}
                        
                    {% else %}

                            <a href="{{ card_data.actionUrl }}" class="button {% if alt_button_colors is not empty %} buttonAlt {% endif %} withIcon">

                                {{  card_data.actionLabel }}

                                <i class="svgIcon">
                                    {{ file_get_contents(settings.SITE_PATH ~ settings.THEME_URL ~ '/images/icons/long-arrow-right.svg')|raw }}
                                </i>

                            </a>
                            
                    {% endif %}
                    
                {% endif %}
                
            </div><!-- . buttonWrap -->
          
      {% else %}
        
            {% if button_link_1 is not empty or button_link_2 is not empty %}
        
                <div class="buttonWrap">
        
                    {% if button_link_1 is not empty and button_text_1 is not empty %}
                        <a href="{{ button_link_1 }}" class="button {% if alt_button_colors is not empty %} buttonAlt {% endif %} withIcon">
                            {{  button_text_1 }}
                            
                            <i class="svgIcon">
                                {{ file_get_contents(settings.SITE_PATH ~ settings.THEME_URL ~ '/images/icons/long-arrow-right.svg')|raw }}
                            </i>
                        </a>
                    {% endif %}
        
                    {% if button_link_2 is not empty and button_text_2 is not empty %}
                        <a
                                href="{{ button_link_2 }}"
                                class="
                                button {% if alt_button_colors is not empty %} buttonAlt {% endif %}
                                {% if scrollTo is not empty %} js_scrollTo{% endif %}
                                "
                        >
                            {{ button_text_2 }}
                        </a>
                    {% endif %}
        
                </div> <!-- .buttonWrap -->
        
            {% endif %}

      {% endif %}

    </div> <!-- .innerText -->

  

</div> <!-- .titleWrap -->
