{$filterCampaigns = []}
{foreach $cfg.Products.Flags as $id => $flag}
    {if $flag.in_filter}
        {$filterCampaigns[$id] = $id}
    {/if}
{/foreach}
{if $filterCampaigns}
    {$body.dynamic_filter.campaigns = $body.dynamic_filter.filter->getCampaigns($filterCampaigns) scope="global"}
    {if $body.dynamic_filter.campaigns}
       <div class="filter-row filter-campaigns">
           {if $filter_openers}
              <button type="button" class="filter-label"
                      data-opener="[data-opener-param-campaigns]">{t}Kampaně{/t}</button>
           {else}
              <p class="filter-label">{t}Kampaně{/t}</p>
           {/if}
          <div {if $filter_openers}class="opener-content" data-opener-param-campaigns{/if}>
              {foreach $body.dynamic_filter.campaigns.values as  $campaign_key => $campaign}
                 <label class="custom-control custom-checkbox">
                    <input class="custom-control-input" type="checkbox" name="dynamic_filter[campaigns][{$campaign_key}]" value="{$campaign_key}"
                           data-filter-input="{$cfg.Products.Flags[$campaign_key].plural|strip_accent}"
                           {if in_array($campaign_key, $body.dynamic_filter.filterParams->getCampaigns())}checked{/if}
                           data-tracking-filter='{get_gtm_data encode=true type='ecommerce' method='ApplyFilterCampaigns' data=['id' => $campaign_key, 'name' => $cfg.Products.Flags[$campaign_key].plural]}'
                    />
                    <span class="custom-control-indicator"></span>
                    {$translation = $campaign_key|translate:'campaigns':true}
                    {$translation.plural|default:$cfg.Products.Flags[$campaign_key].plural}
                 </label>
              {/foreach}
          </div>
       </div>
    {/if}
{/if}

