public static function Single::isApplicable in Better Exposed Filters 8.4
Same name and namespace in other branches
- 8.5 src/Plugin/better_exposed_filters/filter/Single.php \Drupal\better_exposed_filters\Plugin\better_exposed_filters\filter\Single::isApplicable()
Verify this plugin can be used on the form element.
Parameters
mixed $handler: The handler type we are altering (e.g. filter, pager, sort).
array $options: The options for this handler.
Return value
bool If this plugin can be used.
Overrides FilterWidgetBase::isApplicable
File
- src/
Plugin/ better_exposed_filters/ filter/ Single.php, line 20
Class
- Single
- Single on/off widget implementation.
Namespace
Drupal\better_exposed_filters\Plugin\better_exposed_filters\filterCode
public static function isApplicable($filter = NULL, array $filter_options = []) {
/** @var \Drupal\views\Plugin\views\filter\FilterPluginBase $filter */
$is_applicable = FALSE;
// Sanity check to ensure we have a filter to work with.
if (!isset($filter)) {
return $is_applicable;
}
if (is_a($filter, 'Drupal\\views\\Plugin\\views\\filter\\BooleanOperator') || $filter
->isAGroup() && count($filter->options['group_info']['group_items']) == 1) {
$is_applicable = TRUE;
}
return $is_applicable;
}