42 public const TYPE =
'string_options';
52 public const ALL =
'all';
113 if ( !isset( $groupDefinition[
'isFullCoverage'] ) ) {
114 throw new InvalidArgumentException(
'You must specify isFullCoverage' );
119 parent::__construct( $groupDefinition );
121 $this->queryCallable = $groupDefinition[
'queryCallable'];
123 if ( isset( $groupDefinition[
'default'] ) ) {
124 $this->
setDefault( $groupDefinition[
'default'] );
126 throw new InvalidArgumentException(
'You must specify a default' );
162 $this->filters[$filter->
getName()] = $filter;
169 &$tables, &$fields, &$conds, &$query_options, &$join_conds,
172 if ( !$this->isActive( $isStructuredFiltersEnabled ) ) {
176 $value = $opts[ $this->
getName() ];
177 $allowedFilterNames = [];
178 foreach ( $this->filters as $filter ) {
179 $allowedFilterNames[] = $filter->getName();
182 if ( $value === self::ALL ) {
183 $selectedValues = $allowedFilterNames;
185 $selectedValues = explode( self::SEPARATOR, strtolower( $value ) );
188 $selectedValues = array_intersect(
199 if ( count( $selectedValues ) === 0 ) {
203 sort( $selectedValues );
206 get_class( $specialPage ),
222 $output = parent::getJsData();
243 private function isActive( $isStructuredUI ) {
245 return $isStructuredUI;
Represents a filter group (used on ChangesListSpecialPage and descendants)
Special page which uses a ChangesList to show query results.
Represents a filter group with multiple string options.
addOptions(FormOptions $opts, $allowDefaults, $isStructuredFiltersEnabled)
All the options represented by this filter group to $opts.
getDefault()
Gets default of filter group.
__construct(array $groupDefinition)
Create a new filter group with the specified configuration.
string $defaultValue
Default parameter value.
registerFilter(ChangesListStringOptionsFilter $filter)
Registers a filter in this group.
const ALL
Signifies that all options in the group are selected.
const TYPE
Type marker, used by JavaScript.
callable $queryCallable
Callable used to do the actual query modification; see constructor.
const SEPARATOR
Delimiter.
createFilter(array $filterDefinition)
Creates a filter of the appropriate type for this group, from the definition.ChangesListFilter Filter
setDefault( $defaultValue)
Sets default of filter group.
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...
getJsData()
Gets the JS data in the format required by the front-end of the structured UI.array|null Associative ...
const NONE
Signifies that no options in the group are selected, meaning the group has no effect.
An individual filter in a ChangesListStringOptionsFilterGroup.
getContext()
Gets the context this SpecialPage is executed in.