MediaWiki master
ChangesListBooleanFilterGroup.php
Go to the documentation of this file.
1<?php
2
6
20 public const TYPE = 'send_unselected_if_any';
21
44 public function __construct( array $groupDefinition ) {
45 $groupDefinition['isFullCoverage'] = true;
46 $groupDefinition['type'] = self::TYPE;
47
48 parent::__construct( $groupDefinition );
49 }
50
54 protected function createFilter( array $filterDefinition ) {
55 return new ChangesListBooleanFilter( $filterDefinition );
56 }
57
64 public function registerFilter( ChangesListBooleanFilter $filter ) {
65 $this->filters[$filter->getName()] = $filter;
66 }
67
71 public function modifyQuery( IReadableDatabase $dbr, ChangesListSpecialPage $specialPage,
72 &$tables, &$fields, &$conds, &$query_options, &$join_conds,
73 FormOptions $opts, $isStructuredFiltersEnabled
74 ) {
76 foreach ( $this->getFilters() as $filter ) {
77 if ( $filter->isActive( $opts, $isStructuredFiltersEnabled ) ) {
78 $filter->modifyQuery( $dbr, $specialPage, $tables, $fields, $conds,
79 $query_options, $join_conds );
80 }
81 }
82 }
83
87 public function addOptions( FormOptions $opts, $allowDefaults, $isStructuredFiltersEnabled ) {
89 foreach ( $this->getFilters() as $filter ) {
90 $defaultValue = $allowDefaults ? $filter->getDefault( $isStructuredFiltersEnabled ) : false;
91 $opts->add( $filter->getName(), $defaultValue );
92 }
93 }
94}
If the group is active, any unchecked filters will translate to hide parameters in the URL.
const TYPE
Type marker, used by JavaScript.
modifyQuery(IReadableDatabase $dbr, ChangesListSpecialPage $specialPage, &$tables, &$fields, &$conds, &$query_options, &$join_conds, FormOptions $opts, $isStructuredFiltersEnabled)
Modifies the query to include the filter group.The modification is only done if the filter group is i...
registerFilter(ChangesListBooleanFilter $filter)
Registers a filter in this group.
__construct(array $groupDefinition)
Create a new filter group with the specified configuration.
addOptions(FormOptions $opts, $allowDefaults, $isStructuredFiltersEnabled)
All the options represented by this filter group to $opts.
createFilter(array $filterDefinition)
Creates a filter of the appropriate type for this group, from the definition.ChangesListFilter Filter
Represents a hide-based boolean filter (used on ChangesListSpecialPage and descendants)
Represents a filter group (used on ChangesListSpecialPage and descendants)
Helper class to keep track of options when mixing links and form elements.
add( $name, $default, $type=self::AUTO)
Add an option to be handled by this FormOptions instance.
Special page which uses a ChangesList to show query results.
A database connection without write operations.