41 public const TYPE =
'string_options';
51 public const ALL =
'all';
112 if ( !isset( $groupDefinition[
'isFullCoverage'] ) ) {
113 throw new MWException(
'You must specify isFullCoverage' );
118 parent::__construct( $groupDefinition );
120 $this->queryCallable = $groupDefinition[
'queryCallable'];
122 if ( isset( $groupDefinition[
'default'] ) ) {
123 $this->
setDefault( $groupDefinition[
'default'] );
125 throw new MWException(
'You must specify a default' );
161 $this->filters[$filter->
getName()] = $filter;
168 &$tables, &$fields, &$conds, &$query_options, &$join_conds,
171 if ( !$this->isActive( $isStructuredFiltersEnabled ) ) {
175 $value = $opts[ $this->
getName() ];
176 $allowedFilterNames = [];
177 foreach ( $this->filters as $filter ) {
178 $allowedFilterNames[] = $filter->getName();
181 if ( $value === self::ALL ) {
182 $selectedValues = $allowedFilterNames;
184 $selectedValues = explode( self::SEPARATOR, strtolower( $value ) );
187 $selectedValues = array_intersect(
198 if ( count( $selectedValues ) === 0 ) {
202 sort( $selectedValues );
205 get_class( $specialPage ),
221 $output = parent::getJsData();
242 private function isActive( $isStructuredUI ) {
244 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.