XF 2.2 replace filter for a checkbox?

Robert9

Well-known member
Code:
<a href="{{ link($route, $contentParent, $filters|replace('check_box', null)) }}"
                 class="filterBar-filterToggle" data-xf-init="tooltip" title="{{ phrase('remove_this_filter')|for_attr }}">

I have a checkbox with three values in my filter form;
the problem now is to have three different links done by link($route, $contentParent, $filters

Should I use three different checkboxes to have three different names to replace?
Do we have any example to view it is done?
 
Solved with example from

XML:
<xf:foreach loop="$filters.prefix_id" value="$prefixId">
    <xf:set var="$newFilters" value="{$filters}" />
    <xf:set var="$newFilters.prefix_id" value="{$newFilters.prefix_id|replaceValue($prefixId, null)}" />

    <li><a href="{{ link($baseLinkPath, $container, $newFilters) }}"
           class="filterBar-filterToggle" data-xf-init="tooltip" title="{{ phrase('remove_this_filter')|for_attr }}">
        <span class="filterBar-filterToggle-label">{{ phrase('prefix:') }}</span>
        {{ $prefixId ? prefix_title($prefixType, $prefixId) : phrase('(none)') }}</a></li>
</xf:foreach>
 
Back
Top Bottom