110 parent::__construct( $filterDefinition );
112 if ( isset( $filterDefinition[
'showHide'] ) ) {
113 $this->showHide = $filterDefinition[
'showHide'];
116 $this->isReplacedInStructuredUi = $filterDefinition[
'isReplacedInStructuredUi'] ??
false;
118 if ( isset( $filterDefinition[
'default'] ) ) {
119 $this->
setDefault( $filterDefinition[
'default'] );
121 throw new InvalidArgumentException(
'You must set a default' );
124 if ( isset( $filterDefinition[
'queryCallable'] ) ) {
125 $this->queryCallable = $filterDefinition[
'queryCallable'];
128 $this->activeValue = $filterDefinition[
'activeValue'] ??
true;
138 return $this->isReplacedInStructuredUi && $structuredUI ?
139 !$this->activeValue :
158 return $this->showHide;
165 return (
bool)$this->showHide;
172 return $this->isReplacedInStructuredUi ||
173 parent::isFeatureAvailableOnStructuredUi();
189 &$tables, &$fields, &$conds, &$query_options, &$join_conds
191 if ( $this->queryCallable ===
null ) {
195 ( $this->queryCallable )(
196 get_class( $specialPage ),
211 $output = parent::getJsData();
213 $output[
'default'] = $this->defaultValue;
222 return !$opts[ $this->
getName() ] &&
226 return $opts[ $sibling->
getName() ];
237 if ( $this->isReplacedInStructuredUi && $isStructuredUI ) {
241 return $opts[ $this->
getName() ] === $this->activeValue;
Represents a hide-based boolean filter (used on ChangesListSpecialPage and descendants)
displaysOnUnstructuredUi()
Checks whether the filter should display on the unstructured UI.bool Whether to display
isSelected(FormOptions $opts)
Checks whether this filter is selected in the provided options.bool
isActive(FormOptions $opts, $isStructuredUI)
modifyQuery(IReadableDatabase $dbr, ChangesListSpecialPage $specialPage, &$tables, &$fields, &$conds, &$query_options, &$join_conds)
Modifies the query to include the filter.
__construct( $filterDefinition)
Create a new filter with the specified configuration.
getJsData()
Gets the JS data required by the front-end of the structured UI.array Associative array Data required...
setDefault( $defaultValue)
Sets default.
bool $isReplacedInStructuredUi
Whether there is a feature designed to replace this filter available on the structured UI.
string $showHide
Main unstructured UI i18n key.
bool $defaultValue
Default.
isFeatureAvailableOnStructuredUi()
Checks whether an equivalent feature for this filter is available on the structured UI....
bool $activeValue
Value that defined when this filter is considered active.
getDefault( $structuredUI=false)
Get the default value.
callable $queryCallable
Callable used to do the actual query modification; see constructor.
Represents a filter (used on ChangesListSpecialPage and descendants)
getSiblings()
Get filters in the same group.
Special page which uses a ChangesList to show query results.
getContext()
Gets the context this SpecialPage is executed in.