Skip to content
Snippets Groups Projects
Commit d21b6884 authored by Daniel Wehner's avatar Daniel Wehner Committed by Tim Plunkett
Browse files

convert more filters to annotations

parent d8bfd3b9
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Showing
with 86 additions and 30 deletions
......@@ -7,6 +7,8 @@
namespace Drupal\views\Plugins\views\filter;
use Drupal\Core\Annotation\Plugin;
/**
* Simple filter to handle matching of boolean values
*
......@@ -23,6 +25,12 @@
*
* @ingroup views_filter_handlers
*/
/**
* @plugin(
* plugin_id = "boolean"
* )
*/
class BooleanOperator extends FilterPluginBase {
// exposed filter options
......
......@@ -7,6 +7,8 @@
namespace Drupal\views\Plugins\views\filter;
use Drupal\Core\Annotation\Plugin;
/**
* Simple filter to handle matching of boolean values.
*
......@@ -18,6 +20,12 @@
*
* @ingroup views_filter_handlers
*/
/**
* @plugin(
* plugid_id = "boolean_string"
* )
*/
class BooleanOperatorString extends BooleanOperator {
function query() {
$this->ensure_my_table();
......
......@@ -7,11 +7,19 @@
namespace Drupal\views\Plugins\views\filter;
use Drupal\Core\Annotation\Plugin;
/**
* Filter handler which allows to search on multiple fields.
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "combine"
* )
*/
class Combine extends String {
/**
* @var views_plugin_query_default
......
......@@ -7,11 +7,19 @@
namespace Drupal\views\Plugins\views\filter;
use Drupal\Core\Annotation\Plugin;
/**
* Simple filter to handle equal to / not equal to filters
*
* @ingroup views_filter_handlers
*/
/**
* @plugin(
* plugin_id = "equality"
* )
*/
class Equality extends FilterPluginBase {
// exposed filter options
var $always_multiple = TRUE;
......
......@@ -7,11 +7,19 @@
namespace Drupal\views\Plugins\views\filter;
use Drupal\Core\Annotation\Plugin;
/**
* Simple filter to handle greater than/less than filters
*
* @ingroup views_filter_handlers
*/
/**
* @plugin(
* plugin_id = "groupby_numeric"
* )
*/
class GroupByNumeric extends Numeric {
function query() {
$this->ensure_my_table();
......
......@@ -7,6 +7,8 @@
namespace Drupal\views\Plugins\views\filter;
use Drupal\Core\Annotation\Plugin;
/**
* Simple filter to handle matching of multiple options selectable via checkboxes
*
......@@ -16,6 +18,12 @@
*
* @ingroup views_filter_handlers
*/
/**
* @plugin(
* plugin_id = "in_operator"
* )
*/
class InOperator extends FilterPluginBase {
var $value_form_type = 'checkboxes';
......
......@@ -7,6 +7,8 @@
namespace Drupal\views\Plugins\views\filter;
use Drupal\Core\Annotation\Plugin;
/**
* Complex filter to handle filtering for many to one relationships,
* such as terms (many terms per node) or roles (many roles per user).
......@@ -17,6 +19,12 @@
*
* @ingroup views_filter_handlers
*/
/**
* @plugin(
* plugin_id = "many_to_one"
* )
*/
class ManyToOne extends InOperator {
/**
* @var views_many_to_one_helper
......
......@@ -1532,7 +1532,7 @@ function get_aggregation_info() {
'handler' => array(
'argument' => 'views_handler_argument_group_by_numeric',
'field' => 'views_handler_field_numeric',
'filter' => 'views_handler_filter_group_by_numeric',
'filter' => 'groupby_numeric',
'sort' => 'groupby_numeric',
),
),
......@@ -1542,7 +1542,7 @@ function get_aggregation_info() {
'handler' => array(
'argument' => 'views_handler_argument_group_by_numeric',
'field' => 'views_handler_field_numeric',
'filter' => 'views_handler_filter_group_by_numeric',
'filter' => 'groupby_numeric',
'sort' => 'groupby_numeric',
),
),
......@@ -1551,7 +1551,7 @@ function get_aggregation_info() {
'method' => 'views_query_default_aggregation_method_simple',
'handler' => array(
'argument' => 'views_handler_argument_group_by_numeric',
'filter' => 'views_handler_filter_group_by_numeric',
'filter' => 'groupby_numeric',
'sort' => 'groupby_numeric',
),
),
......@@ -1560,7 +1560,7 @@ function get_aggregation_info() {
'method' => 'views_query_default_aggregation_method_simple',
'handler' => array(
'argument' => 'views_handler_argument_group_by_numeric',
'filter' => 'views_handler_filter_group_by_numeric',
'filter' => 'groupby_numeric',
'sort' => 'groupby_numeric',
),
),
......@@ -1569,7 +1569,7 @@ function get_aggregation_info() {
'method' => 'views_query_default_aggregation_method_simple',
'handler' => array(
'argument' => 'views_handler_argument_group_by_numeric',
'filter' => 'views_handler_filter_group_by_numeric',
'filter' => 'groupby_numeric',
'sort' => 'groupby_numeric',
),
),
......@@ -1578,7 +1578,7 @@ function get_aggregation_info() {
'method' => 'views_query_default_aggregation_method_simple',
'handler' => array(
'argument' => 'views_handler_argument_group_by_numeric',
'filter' => 'views_handler_filter_group_by_numeric',
'filter' => 'groupby_numeric',
'sort' => 'groupby_numeric',
),
),
......@@ -1587,7 +1587,7 @@ function get_aggregation_info() {
'method' => 'views_query_default_aggregation_method_simple',
'handler' => array(
'argument' => 'views_handler_argument_group_by_numeric',
'filter' => 'views_handler_filter_group_by_numeric',
'filter' => 'groupby_numeric',
'sort' => 'groupby_numeric',
),
)
......
......@@ -279,7 +279,7 @@ function comment_views_data() {
),
),
'filter' => array(
'handler' => 'views_handler_filter_boolean_operator',
'plugin_id' => 'boolean',
'label' => t('Approved comment'),
'type' => 'yes-no',
),
......
......@@ -184,7 +184,7 @@ function locale_views_data() {
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_boolean_operator',
'plugin_id' => 'boolean',
'label' => t('Plural'),
'type' => 'yes-no',
),
......
......@@ -105,7 +105,7 @@ function node_views_data() {
'plugin_id' => 'date'
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\Date',
'plugin_id' => 'date',
),
);
......@@ -121,7 +121,7 @@ function node_views_data() {
'plugin_id' => 'date'
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\Date',
'plugin_id' => 'date',
),
);
......@@ -156,7 +156,7 @@ function node_views_data() {
),
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\BooleanOperator',
'plugin_id' => 'boolean',
'label' => t('Published'),
'type' => 'yes-no',
'use equal' => TRUE, // Use status = 1 instead of status <> 0 in WHERE statment
......@@ -189,7 +189,7 @@ function node_views_data() {
),
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\BooleanOperator',
'plugin_id' => 'boolean',
'label' => t('Promoted to front page'),
'type' => 'yes-no',
),
......@@ -211,7 +211,7 @@ function node_views_data() {
),
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\BooleanOperator',
'plugin_id' => 'boolean',
'label' => t('Sticky'),
'type' => 'yes-no',
),
......@@ -535,7 +535,7 @@ function node_views_data() {
'plugin_id' => 'date'
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\Date',
'plugin_id' => 'date',
),
);
......
......@@ -34,7 +34,7 @@ function poll_views_data() {
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_boolean_operator',
'plugin_id' => 'boolean',
'label' => t('Active'),
'type' => 'yes-no',
),
......
......@@ -89,7 +89,7 @@ function search_views_data() {
'handler' => 'views_handler_argument_node_nid',
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\Equality',
'plugin_id' => 'equality',
),
);
......@@ -107,7 +107,7 @@ function search_views_data() {
'handler' => 'views_handler_argument_node_nid',
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\Equality',
'plugin_id' => 'equality',
),
);
......
......@@ -70,7 +70,7 @@ function statistics_views_data() {
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\Date',
'plugin_id' => 'date',
),
'sort' => array(
'plugin_id' => 'standard',
......@@ -254,7 +254,7 @@ function statistics_views_data() {
'plugin_id' => 'standard',
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\Date',
'plugin_id' => 'date',
),
);
......
......@@ -163,7 +163,7 @@ function system_views_data() {
'plugin_id' => 'date'
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\Date',
'plugin_id' => 'date',
),
);
......@@ -535,7 +535,7 @@ function system_views_data() {
'name field' => 'status', // the field to display in the summary.
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\BooleanOperator',
'plugin_id' => 'boolean',
),
'sort' => array(
'plugin_id' => 'standard',
......
......@@ -98,7 +98,7 @@ function translation_views_data_alter(&$data) {
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\BooleanOperator',
'plugin_id' => 'boolean',
'label' => t('Outdated'),
'type' => 'yes-no',
),
......
......@@ -183,7 +183,7 @@ function user_views_data() {
'plugin_id' => 'standard',
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\BooleanOperator',
'plugin_id' => 'boolean',
'label' => t('Has Avatar'),
'type' => 'yes-no',
),
......@@ -210,7 +210,7 @@ function user_views_data() {
'plugin_id' => 'date'
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\Date',
'plugin_id' => 'date',
),
);
......@@ -281,7 +281,7 @@ function user_views_data() {
'plugin_id' => 'date'
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\Date',
'plugin_id' => 'date',
),
);
......@@ -297,7 +297,7 @@ function user_views_data() {
'plugin_id' => 'date'
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\Date',
'plugin_id' => 'date',
),
);
......@@ -314,7 +314,7 @@ function user_views_data() {
),
),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\BooleanOperator',
'plugin_id' => 'boolean',
'label' => t('Active'),
'type' => 'yes-no',
),
......
......@@ -95,7 +95,7 @@ function views_views_data() {
'title' => t('Combine fields filter'),
'help' => t('Combine two fields together and search by them.'),
'filter' => array(
'handler' => 'Drupal\views\Plugins\views\filter\Combine',
'plugin_id' => 'combine',
),
);
......
......@@ -423,7 +423,7 @@ function hook_views_data() {
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_boolean_operator',
'plugin_id' => 'boolean',
// Note that you can override the field-wide label:
'label' => t('Published'),
// This setting is used by the boolean filter handler, as possible option.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment