!empty($quickFilterForMetaField['wildcard_search']) ]; } $filterEffective = !empty($quickFilter); // No filters will be picked up, thus rendering the filtering useless $filteringButton = ''; if (!empty($data['allowFilering'])) { $activeFilters = !empty($activeFilters) ? $activeFilters : []; $numberActiveFilters = count($activeFilters); if (!empty($activeFilters['filteringMetaFields'])) { $numberActiveFilters += count($activeFilters['filteringMetaFields']) - 1; } $buttonConfig = [ 'icon' => 'filter', 'variant' => $numberActiveFilters > 0 ? 'warning' : 'primary', 'params' => [ 'title' => __('Filter index'), 'id' => sprintf('toggleFilterButton-%s', h($tableRandomValue)) ] ]; if (count($activeFilters) > 0) { $buttonConfig['badge'] = [ 'variant' => 'light', 'text' => $numberActiveFilters, 'title' => __n('There is {0} active filter', 'There are {0} active filters', $numberActiveFilters, $numberActiveFilters) ]; } $filteringButton = $this->Bootstrap->button($buttonConfig); } $button = empty($data['button']) && empty($data['fa-icon']) ? '' : sprintf( '%s', empty($data['data']) ? '' : h($data['data']), h($tableRandomValue), $filterEffective ? '' : 'disabled="disabled"', empty($data['fa-icon']) ? '' : sprintf('', h($data['fa-icon'])), empty($data['button']) ? '' : h($data['button']), $filteringButton ); if (!empty($data['cancel'])) { $button .= $this->element('/genericElements/ListTopBar/element_simple', array('data' => $data['cancel'])); } $input = sprintf( '', h($tableRandomValue), empty($data['placeholder']) ? '' : h($data['placeholder']), empty($data['placeholder']) ? '' : h($data['placeholder']), empty($data['id']) ? 'quickFilterField' : h($data['id']), empty($data['searchKey']) ? 'searchall' : h($data['searchKey']), empty($data['value']) ? (!empty($quickFilterValue) ? h($quickFilterValue) : '') : h($data['value']), $filterEffective ? '' : 'disabled="disabled"' ); echo sprintf( '
%s%s
', $filterEffective ? '' : 'd-none', h($tableRandomValue), $input, $button ); } ?>