Same name and namespace in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/filter/FilterPluginBase.php \Drupal\views\Plugin\views\filter\views_filter_handlers

Plugins that handle views filtering.

Filter handler plugins extend \Drupal\views\Plugin\views\filter\FilterPluginBase. They must be annotated with \Drupal\views\Annotation\ViewsFilter annotation, and they must be in namespace directory Plugin\views\filter.

The following items can go into a hook_views_data() implementation in a filter section to affect how the filter handler will behave:

  • allow empty: If true, the 'IS NULL' and 'IS NOT NULL' operators become available as standard operators.

You can refine the behavior of filters by setting the following Boolean member variables to TRUE in your plugin class:

  • $alwaysMultiple: Disable the possibility of forcing a single value.
  • $no_operator: Disable the possibility of using operators.
  • $always_required: Disable the possibility of allowing an exposed input to be optional.

See also

Plugin API

Parent topics

File

core/modules/views/src/Plugin/views/filter/FilterPluginBase.php, line 17

Classes

Namesort descending Location Description
Access core/modules/node/src/Plugin/views/filter/Access.php Filter by node_access records.
BooleanOperator core/modules/views/src/Plugin/views/filter/BooleanOperator.php Simple filter to handle matching of boolean values.
BooleanOperatorString core/modules/views/src/Plugin/views/filter/BooleanOperatorString.php Simple filter to handle matching of boolean values.
Broken core/modules/views/src/Plugin/views/filter/Broken.php A special handler to take the place of missing or broken handlers.
Bundle core/modules/views/src/Plugin/views/filter/Bundle.php Filter class which allows filtering by entity bundles.
Current core/modules/user/src/Plugin/views/filter/Current.php Filter handler for the current user.
Date core/modules/datetime/src/Plugin/views/filter/Date.php Date/time views filter.
Date core/modules/views/src/Plugin/views/filter/Date.php Filter to handle dates stored as a timestamp.
Equality core/modules/views/src/Plugin/views/filter/Equality.php Simple filter to handle equal to / not equal to filters.
FilterBooleanOperatorDefaultTest core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterBooleanOperatorDefaultTest.php Filter to test queryOpBoolean() with default operator.
FilterPluginBase core/modules/views/src/Plugin/views/filter/FilterPluginBase.php Base class for Views filters handler plugins.
GroupByNumeric core/modules/views/src/Plugin/views/filter/GroupByNumeric.php Simple filter to handle greater than/less than filters.
HistoryUserTimestamp core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php Filter for new content.
InOperator core/modules/views/src/Plugin/views/filter/InOperator.php Simple filter to handle matching of multiple options selectable via checkboxes.
LanguageFilter core/modules/views/src/Plugin/views/filter/LanguageFilter.php Provides filtering by language.
LatestRevision core/modules/views/src/Plugin/views/filter/LatestRevision.php Filter to show only the latest revision of an entity.
LatestTranslationAffectedRevision core/modules/views/src/Plugin/views/filter/LatestTranslationAffectedRevision.php Filter to show only the latest translation affected revision of an entity.
ListField core/modules/options/src/Plugin/views/filter/ListField.php Filter handler which uses list-fields as options.
ManyToOne core/modules/views/src/Plugin/views/filter/ManyToOne.php Complex filter to handle filtering for many to one relationships.
ModerationStateFilter core/modules/content_moderation/src/Plugin/views/filter/ModerationStateFilter.php Provides a filter for the moderation state of an entity.
Name core/modules/user/src/Plugin/views/filter/Name.php Filter handler for usernames.
NodeComment core/modules/comment/src/Plugin/views/filter/NodeComment.php Filter based on comment node status.
NumericFilter core/modules/views/src/Plugin/views/filter/NumericFilter.php Simple filter to handle greater than/less than filters.
Permissions core/modules/user/src/Plugin/views/filter/Permissions.php Filter handler for user roles.
Roles core/modules/user/src/Plugin/views/filter/Roles.php Filter handler for user roles.
Search core/modules/search/src/Plugin/views/filter/Search.php Filter handler for search keywords.
Standard core/modules/views/src/Plugin/views/filter/Standard.php Default implementation of the base filter plugin.
StatisticsLastUpdated core/modules/comment/src/Plugin/views/filter/StatisticsLastUpdated.php Filter handler for the newer of last comment / node updated.
Status core/modules/file/src/Plugin/views/filter/Status.php Filter by file status.
Status core/modules/media/src/Plugin/views/filter/Status.php Filter by published status.
Status core/modules/node/src/Plugin/views/filter/Status.php Filter by published status.
StringFilter core/modules/views/src/Plugin/views/filter/StringFilter.php Basic textfield filter to handle string filtering commands.
TaxonomyIndexTid core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php Filter by term id.
TaxonomyIndexTidDepth core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTidDepth.php Filter handler for taxonomy terms with depth.
UidRevision core/modules/node/src/Plugin/views/filter/UidRevision.php Filter handler to check for revisions a certain user has created.
UserUid core/modules/tracker/src/Plugin/views/filter/UserUid.php UID filter to check for nodes that a user posted or commented on.
UserUid core/modules/comment/src/Plugin/views/filter/UserUid.php Filter handler, accepts user ID to check for nodes user posted/commented on.
ViewsFilter core/modules/views/src/Annotation/ViewsFilter.php Defines a Plugin annotation object for views filter handlers.