{#
/**
 * @file
 * Theme override to display a region.
 *
 * Available variables:
 * - content: The content for this region, typically blocks.
 * - attributes: HTML attributes for the region <div>.
 * - region: The name of the region variable as defined in the theme's
 *   .info.yml file.
 *
 * @see template_preprocess_region()
 */
#}

{% set footer_attributes = create_attribute() %}

{%
  set footer_classes = [
    'region-microsites-footer',
    microsites.footer.width.content_centered ? 'lgd-container' : '',
  ]
%}

{%
  set footer_banner_classes = [
    'microsite-footer__banner',
    microsites.footer.width.content_centered ? 'lgd-container' : '',
    microsites.footer.width.full_width_content_contained ? 'lgd-container padding-horizontal' : '',
  ]
%}

{{ attach_library('localgov_microsites_base/footer') }}

{% if microsites.footer.items.lgms_footer_banner %}
  <div {{ attributes.addClass(footer_banner_classes) }}>
    {{ microsites.footer.items.lgms_footer_banner }}
  </div>
{% endif %}

<div{{ footer_attributes.addClass(footer_classes) }}>

{% if microsites.footer.width.full_width_content_contained %}
  <div class="lgd-container padding-horizontal">
{% endif %}
  <div class="lgd-region__inner lgd-region__inner--{{ region|clean_class }}">
  
{% if microsites.footer.items.lgms_footer_text_block_1 or microsites.footer.items.lgms_footer_text_block_2 or microsites.footer.items.lgms_footer_text_block_3 or microsites.footer.items.lgms_footer_text_block_4 %}
  <div class="lgd-row">    
    {# Begin Footer text blocks #}
      {% if microsites.footer.items.lgms_footer_text_block_1 %}
        <div class="lgd-row__one-quarter">
          <div class="microsite-footer__block microsite-footer__text-block microsite-footer__text-block--1">
            {{ microsites.footer.items.lgms_footer_text_block_1 }}
          </div>
        </div>
      {% endif %}
      {% if microsites.footer.items.lgms_footer_text_block_2 %}
        <div class="lgd-row__one-quarter">
          <div class="microsite-footer__block microsite-footer__text-block microsite-footer__text-block--2">
            {{ microsites.footer.items.lgms_footer_text_block_2 }}
          </div>
        </div>
      {% endif %}
      {% if microsites.footer.items.lgms_footer_text_block_3 %}
        <div class="lgd-row__one-quarter">
          <div class="microsite-footer__block microsite-footer__text-block microsite-footer__text-block--3">
            {{ microsites.footer.items.lgms_footer_text_block_3 }}
          </div>
        </div>
      {% endif %}
      {% if microsites.footer.items.lgms_footer_text_block_4 %}
        <div class="lgd-row__one-quarter">
          <div class="microsite-footer__block microsite-footer__text-block microsite-footer__text-block--4">
            {{ microsites.footer.items.lgms_footer_text_block_4 }}
          </div>
        </div>
      {% endif %}
    {# End Footer text blocks #}
  </div> 
{% endif %} 

    {# Begin Footer Logos #}
      {% if microsites.footer.items.lgms_footer_logos %}
        <div class="lgd-row">
          <div class="lgd-row__full">
            <div class="microsite-footer__block microsite-footer__logos">
            {{ microsites.footer.items.lgms_footer_logos }}
            </div>
          </div>
        </div>
      {% endif %}
    {# End Footer Logos #}

    {# Begin Footer Housekeeping Menu #}
      {% if has_footer_menu %}
        <div class="lgd-row">
          <div class="lgd-row__full">
            <div class="microsite-footer__block microsite-footer__housekeeping">
            {{ page.footer_menu }}
            </div>
          </div>
        </div>
      {% endif %}

    {# End Footer Housekeeping Menu #}

    {# Begin Footer Copyright Notice #}
      {% if microsites.footer.items.lgms_footer_copyright_notice %}
        <div class="lgd-row">
          <div class="lgd-row__full">
            <div class="microsite-footer__block microsite-footer__copyright">
            {{ microsites.footer.items.lgms_footer_copyright_notice }}
            </div>
          </div>
        </div>
      {% endif %}
    {# End Footer Copyright Notice #}

    {# Begin Footer Powered By #}
      {% if microsites.footer.items.lgms_powered_by %}
        <div class="lgd-row">
          <div class="lgd-row__full">
            <div class="microsite-footer__block microsite-footer__powered_by">
            {{ microsites.footer.items.lgms_powered_by }}
            </div>
          </div>
        </div>
      {% endif %}
    {# End Footer Powered By #}
  </div>
{% if microsites.footer.width.full_width_content_contained %}
  </div>
{% endif %}
</div>
