MediaWiki master
ChangesListBooleanFilterGroup.php
Go to the documentation of this file.
1<?php
2
6
19 public const TYPE = 'send_unselected_if_any';
20
43 public function __construct( array $groupDefinition ) {
44 $groupDefinition['isFullCoverage'] = true;
45 $groupDefinition['type'] = self::TYPE;
46
47 parent::__construct( $groupDefinition );
48 }
49
53 protected function createFilter( array $filterDefinition ) {
54 return new ChangesListBooleanFilter( $filterDefinition );
55 }
56
63 public function registerFilter( ChangesListBooleanFilter $filter ) {
64 $this->filters[$filter->getName()] = $filter;
65 }
66
70 public function modifyQuery( IReadableDatabase $dbr, ChangesListSpecialPage $specialPage,
71 &$tables, &$fields, &$conds, &$query_options, &$join_conds,
72 FormOptions $opts, $isStructuredFiltersEnabled
73 ) {
75 foreach ( $this->getFilters() as $filter ) {
76 if ( $filter->isActive( $opts, $isStructuredFiltersEnabled ) ) {
77 $filter->modifyQuery( $dbr, $specialPage, $tables, $fields, $conds,
78 $query_options, $join_conds );
79 }
80 }
81 }
82
86 public function addOptions( FormOptions $opts, $allowDefaults, $isStructuredFiltersEnabled ) {
88 foreach ( $this->getFilters() as $filter ) {
89 $defaultValue = $allowDefaults ? $filter->getDefault( $isStructuredFiltersEnabled ) : false;
90 $opts->add( $filter->getName(), $defaultValue );
91 }
92 }
93}
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.