- Issue created by @fengtan
The reset link count ignores excluded facet items:
Steps to reproduce:
I tried to tweak the processor orders under fieldset "Advanced settings", to no avail. All processors seem to run before the reset link is built in the widget class, so seems to be no way for the former to run after the latter.
As a workaround I have overridden the widget class and made my facet use that custom widget, though it would be best if this was natively supported:
class MyLinksWidget extends LinksWidget {
/**
* {@inheritdoc}
*/
public function build(FacetInterface $facet) {
$build = parent::build($facet);
if ($facet->id() == 'my_facet_ss') {
$exclude = [
'rockets',
'bikes',
];
foreach ($build['#items'] as $key => $item) {
if (in_array($item['#title']['#raw_value'], $exclude)) {
unset($build['#items'][$key]);
}
}
}
return $build;
}
}
Active
3.0
Code