MediaWiki master
ChangesListBooleanFilterGroup.php
Go to the documentation of this file.
1<?php
2
4
8
22 public const TYPE = 'send_unselected_if_any';
23
46 public function __construct( array $groupDefinition ) {
47 $groupDefinition['isFullCoverage'] = true;
48 $groupDefinition['type'] = self::TYPE;
49
50 parent::__construct( $groupDefinition );
51 }
52
56 protected function createFilter( array $filterDefinition ) {
57 return new ChangesListBooleanFilter( $filterDefinition );
58 }
59
66 public function registerFilter( ChangesListBooleanFilter $filter ) {
67 $this->filters[$filter->getName()] = $filter;
68 }
69
73 public function modifyQuery( IReadableDatabase $dbr, ChangesListSpecialPage $specialPage,
74 &$tables, &$fields, &$conds, &$query_options, &$join_conds,
75 FormOptions $opts, $isStructuredFiltersEnabled
76 ) {
78 foreach ( $this->getFilters() as $filter ) {
79 if ( $filter->isActive( $opts, $isStructuredFiltersEnabled ) ) {
80 $filter->modifyQuery( $dbr, $specialPage, $tables, $fields, $conds,
81 $query_options, $join_conds );
82 }
83 }
84 }
85
89 public function addOptions( FormOptions $opts, $allowDefaults, $isStructuredFiltersEnabled ) {
91 foreach ( $this->getFilters() as $filter ) {
92 $defaultValue = $allowDefaults ? $filter->getDefault( $isStructuredFiltersEnabled ) : false;
93 $opts->add( $filter->getName(), $defaultValue );
94 }
95 }
96}
97
99class_alias( ChangesListBooleanFilterGroup::class, 'ChangesListBooleanFilterGroup' );
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.
If the group is active, any unchecked filters will translate to hide parameters in the URL.
addOptions(FormOptions $opts, $allowDefaults, $isStructuredFiltersEnabled)
All the options represented by this filter group to $opts.
registerFilter(ChangesListBooleanFilter $filter)
Registers a filter in this group.
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...
createFilter(array $filterDefinition)
Creates a filter of the appropriate type for this group, from the definition.ChangesListFilter Filter
__construct(array $groupDefinition)
Create a new filter group with the specified configuration.
Represents a hide-based boolean filter (used on ChangesListSpecialPage and descendants)
Represents a filter group (used on ChangesListSpecialPage and descendants)
Special page which uses a ChangesList to show query results.
A database connection without write operations.