MediaWiki  master
ChangesListBooleanFilterGroup.php
Go to the documentation of this file.
1 <?php
2 
5 
18  public const TYPE = 'send_unselected_if_any';
19 
42  public function __construct( array $groupDefinition ) {
43  $groupDefinition['isFullCoverage'] = true;
44  $groupDefinition['type'] = self::TYPE;
45 
46  parent::__construct( $groupDefinition );
47  }
48 
52  protected function createFilter( array $filterDefinition ) {
53  return new ChangesListBooleanFilter( $filterDefinition );
54  }
55 
62  public function registerFilter( ChangesListBooleanFilter $filter ) {
63  $this->filters[$filter->getName()] = $filter;
64  }
65 
69  public function modifyQuery( IDatabase $dbr, ChangesListSpecialPage $specialPage,
70  &$tables, &$fields, &$conds, &$query_options, &$join_conds,
71  FormOptions $opts, $isStructuredFiltersEnabled
72  ) {
74  foreach ( $this->getFilters() as $filter ) {
75  if ( $filter->isActive( $opts, $isStructuredFiltersEnabled ) ) {
76  $filter->modifyQuery( $dbr, $specialPage, $tables, $fields, $conds,
77  $query_options, $join_conds );
78  }
79  }
80  }
81 
85  public function addOptions( FormOptions $opts, $allowDefaults, $isStructuredFiltersEnabled ) {
87  foreach ( $this->getFilters() as $filter ) {
88  $defaultValue = $allowDefaults ? $filter->getDefault( $isStructuredFiltersEnabled ) : false;
89  $opts->add( $filter->getName(), $defaultValue );
90  }
91  }
92 }
If the group is active, any unchecked filters will translate to hide parameters in the URL.
modifyQuery(IDatabase $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...
const TYPE
Type marker, used by JavaScript.
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)
Special page which uses a ChangesList to show query results.
Helper class to keep track of options when mixing links and form elements.
Definition: FormOptions.php:41
add( $name, $default, $type=self::AUTO)
Add an option to be handled by this FormOptions instance.
Definition: FormOptions.php:89
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:36