MediaWiki master
MediaWiki\RecentChanges\ChangesListFilterGroup Class Reference

Represents a filter group (used on ChangesListSpecialPage and descendants) More...

Inherited by MediaWiki\RecentChanges\ChangesListBooleanFilterGroup, and MediaWiki\RecentChanges\ChangesListStringOptionsFilterGroup.

Collaboration diagram for MediaWiki\RecentChanges\ChangesListFilterGroup:

Public Member Functions

 __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.
 
 anySelected (FormOptions $opts)
 Check if any filter in this group is selected.
 
 conflictsWith ( $other, string $globalKey, string $forwardKey, string $backwardKey)
 Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object.
 
 getConflictingFilters ()
 Get filters conflicting with this filter group.
 
 getConflictingGroups ()
 Get groups conflicting with this filter group.
 
 getFilter ( $name)
 Get filter by name.
 
 getFilters ()
 
 getJsData ()
 Gets the JS data in the format required by the front-end of the structured UI.
 
 getName ()
 
 getPriority ()
 
 getTitle ()
 
 getType ()
 
 modifyQuery (IReadableDatabase $dbr, ChangesListSpecialPage $specialPage, &$tables, &$fields, &$conds, &$query_options, &$join_conds, FormOptions $opts, $isStructuredFiltersEnabled)
 Modifies the query to include the filter group.
 
 setUnidirectionalConflict ( $other, $globalDescription, $contextDescription)
 Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object.
 

Protected Member Functions

 createFilter (array $filterDefinition)
 Creates a filter of the appropriate type for this group, from the definition.
 

Protected Attributes

array $conflictingFilters = []
 Array of associative arrays with conflict information.
 
array $conflictingGroups = []
 Array of associative arrays with conflict information.
 
ChangesListFilter[] $filters
 Associative array of filters, as ChangesListFilter objects, with filter name as key.
 
bool $isFullCoverage
 Whether this group is full coverage.
 
string $name
 Name (internal identifier)
 
int $priority
 Priority integer.
 
string $title
 i18n key for title
 
string $type
 Type, from a TYPE constant of a subclass.
 
string null $whatsThisBody
 i18n key for body of What's This?
 
string null $whatsThisHeader
 i18n key for header of What's This?
 
string null $whatsThisLinkText
 i18n key for What's This? link
 
string null $whatsThisUrl
 URL of What's This? link.
 

Detailed Description

Represents a filter group (used on ChangesListSpecialPage and descendants)

Todo
Might want to make a super-class or trait to share behavior (especially re conflicts) between ChangesListFilter and ChangesListFilterGroup. What to call it. FilterStructure? That would also let me make setUnidirectionalConflict protected.
Since
1.29
Author
Matthew Flaschen @method registerFilter($filter)

Definition at line 41 of file ChangesListFilterGroup.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\RecentChanges\ChangesListFilterGroup::__construct ( array $groupDefinition)

Create a new filter group with the specified configuration.

Parameters
array$groupDefinitionConfiguration of group
  • $groupDefinition['name'] string Group name; use camelCase with no punctuation
  • $groupDefinition['title'] string i18n key for title (optional, can be omitted only if none of the filters in the group display in the structured UI)
  • $groupDefinition['type'] string A type constant from a subclass of this one
  • $groupDefinition['priority'] int Priority integer. Higher value means higher up in the group list (optional, defaults to -100).
  • $groupDefinition['filters'] array Numeric array of filter definitions, each of which is an associative array to be passed to the filter constructor. However, 'priority' is optional for the filters. Any filter that has priority unset will be put to the bottom, in the order given.
  • $groupDefinition['isFullCoverage'] bool Whether the group is full coverage; if true, this means that checking every item in the group means no changes list entries are filtered out.
  • $groupDefinition['whatsThisHeader'] string i18n key for header of "What's This" popup (optional).
  • $groupDefinition['whatsThisBody'] string i18n key for body of "What's This" popup (optional).
  • $groupDefinition['whatsThisUrl'] string URL for main link of "What's This" popup (optional).
  • $groupDefinition['whatsThisLinkText'] string i18n key of text for main link of "What's This" popup (optional).

Reimplemented in MediaWiki\RecentChanges\ChangesListBooleanFilterGroup, and MediaWiki\RecentChanges\ChangesListStringOptionsFilterGroup.

Definition at line 160 of file ChangesListFilterGroup.php.

References MediaWiki\RecentChanges\ChangesListFilterGroup\createFilter().

Member Function Documentation

◆ addOptions()

MediaWiki\RecentChanges\ChangesListFilterGroup::addOptions ( FormOptions $opts,
$allowDefaults,
$isStructuredFiltersEnabled )
abstract

All the options represented by this filter group to $opts.

Parameters
FormOptions$opts
bool$allowDefaults
bool$isStructuredFiltersEnabled

Reimplemented in MediaWiki\RecentChanges\ChangesListBooleanFilterGroup, and MediaWiki\RecentChanges\ChangesListStringOptionsFilterGroup.

◆ anySelected()

MediaWiki\RecentChanges\ChangesListFilterGroup::anySelected ( FormOptions $opts)

Check if any filter in this group is selected.

Parameters
FormOptions$opts
Returns
bool

Definition at line 424 of file ChangesListFilterGroup.php.

References MediaWiki\RecentChanges\ChangesListFilterGroup\getFilters(), and MediaWiki\RecentChanges\ChangesListFilter\isSelected().

Referenced by MediaWiki\RecentChanges\ChangesListFilter\activelyInConflictWithGroup().

◆ conflictsWith()

MediaWiki\RecentChanges\ChangesListFilterGroup::conflictsWith ( $other,
string $globalKey,
string $forwardKey,
string $backwardKey )

Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object.

WARNING: This means there is a conflict when both things are shown (not filtered out), even for the hide-based filters. So e.g. conflicting with 'hideanons' means there is a conflict if only anonymous users are shown.

Parameters
ChangesListFilterGroup | ChangesListFilter$other
string$globalKeyi18n key for top-level conflict message
string$forwardKeyi18n key for conflict message in this direction (when in UI context of $this object)
string$backwardKeyi18n key for conflict message in reverse direction (when in UI context of $other object)

Definition at line 233 of file ChangesListFilterGroup.php.

References MediaWiki\RecentChanges\ChangesListFilterGroup\setUnidirectionalConflict().

◆ createFilter()

MediaWiki\RecentChanges\ChangesListFilterGroup::createFilter ( array $filterDefinition)
abstractprotected

Creates a filter of the appropriate type for this group, from the definition.

Parameters
array$filterDefinition
Returns
ChangesListFilter Filter

Reimplemented in MediaWiki\RecentChanges\ChangesListBooleanFilterGroup, and MediaWiki\RecentChanges\ChangesListStringOptionsFilterGroup.

Referenced by MediaWiki\RecentChanges\ChangesListFilterGroup\__construct().

◆ getConflictingFilters()

MediaWiki\RecentChanges\ChangesListFilterGroup::getConflictingFilters ( )

Get filters conflicting with this filter group.

Returns
ChangesListFilter[]

Definition at line 414 of file ChangesListFilterGroup.php.

◆ getConflictingGroups()

MediaWiki\RecentChanges\ChangesListFilterGroup::getConflictingGroups ( )

Get groups conflicting with this filter group.

Returns
ChangesListFilterGroup[]

Definition at line 405 of file ChangesListFilterGroup.php.

◆ getFilter()

MediaWiki\RecentChanges\ChangesListFilterGroup::getFilter ( $name)

Get filter by name.

Parameters
string$nameFilter name
Returns
ChangesListFilter|null Specified filter, or null if it is not registered

Definition at line 323 of file ChangesListFilterGroup.php.

References MediaWiki\RecentChanges\ChangesListFilterGroup\$name.

◆ getFilters()

MediaWiki\RecentChanges\ChangesListFilterGroup::getFilters ( )

◆ getJsData()

MediaWiki\RecentChanges\ChangesListFilterGroup::getJsData ( )

◆ getName()

◆ getPriority()

MediaWiki\RecentChanges\ChangesListFilterGroup::getPriority ( )
Returns
int Priority. Higher means higher in the group list

Definition at line 305 of file ChangesListFilterGroup.php.

References MediaWiki\RecentChanges\ChangesListFilterGroup\$priority.

Referenced by MediaWiki\SpecialPage\ChangesListSpecialPage\getStructuredFilterJsData().

◆ getTitle()

MediaWiki\RecentChanges\ChangesListFilterGroup::getTitle ( )
Returns
string i18n key for title

Definition at line 291 of file ChangesListFilterGroup.php.

References MediaWiki\RecentChanges\ChangesListFilterGroup\$title.

◆ getType()

MediaWiki\RecentChanges\ChangesListFilterGroup::getType ( )
Returns
string Type (TYPE constant from a subclass)

Definition at line 298 of file ChangesListFilterGroup.php.

References MediaWiki\RecentChanges\ChangesListFilterGroup\$type.

◆ modifyQuery()

MediaWiki\RecentChanges\ChangesListFilterGroup::modifyQuery ( IReadableDatabase $dbr,
ChangesListSpecialPage $specialPage,
& $tables,
& $fields,
& $conds,
& $query_options,
& $join_conds,
FormOptions $opts,
$isStructuredFiltersEnabled )
abstract

Modifies the query to include the filter group.

The modification is only done if the filter group is in effect. This means that one or more valid and allowed filters were selected.

Parameters
IReadableDatabase$dbrDatabase, for addQuotes, makeList, and similar
ChangesListSpecialPage$specialPageCurrent special page
array&$tablesArray of tables; see IDatabase::select $table
array&$fieldsArray of fields; see IDatabase::select $vars
array&$condsArray of conditions; see IDatabase::select $conds
array&$query_optionsArray of query options; see IDatabase::select $options
array&$join_condsArray of join conditions; see IDatabase::select $join_conds
FormOptions$optsWrapper for the current request options and their defaults
bool$isStructuredFiltersEnabledTrue if the Structured UI is currently enabled

Reimplemented in MediaWiki\RecentChanges\ChangesListBooleanFilterGroup, and MediaWiki\RecentChanges\ChangesListStringOptionsFilterGroup.

◆ setUnidirectionalConflict()

MediaWiki\RecentChanges\ChangesListFilterGroup::setUnidirectionalConflict ( $other,
$globalDescription,
$contextDescription )

Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object.

Internal use ONLY.

Parameters
ChangesListFilterGroup | ChangesListFilter$other
string$globalDescriptioni18n key for top-level conflict message
string$contextDescriptioni18n key for conflict message in this direction (when in UI context of $this object)

Definition at line 258 of file ChangesListFilterGroup.php.

Referenced by MediaWiki\RecentChanges\ChangesListFilterGroup\conflictsWith().

Member Data Documentation

◆ $conflictingFilters

array MediaWiki\RecentChanges\ChangesListFilterGroup::$conflictingFilters = []
protected

Array of associative arrays with conflict information.

See setUnidirectionalConflict

Definition at line 128 of file ChangesListFilterGroup.php.

◆ $conflictingGroups

array MediaWiki\RecentChanges\ChangesListFilterGroup::$conflictingGroups = []
protected

Array of associative arrays with conflict information.

See setUnidirectionalConflict

Definition at line 120 of file ChangesListFilterGroup.php.

◆ $filters

ChangesListFilter [] MediaWiki\RecentChanges\ChangesListFilterGroup::$filters
protected

Associative array of filters, as ChangesListFilter objects, with filter name as key.

Definition at line 104 of file ChangesListFilterGroup.php.

Referenced by MediaWiki\RecentChanges\ChangesListFilterGroup\getFilters().

◆ $isFullCoverage

bool MediaWiki\RecentChanges\ChangesListFilterGroup::$isFullCoverage
protected

Whether this group is full coverage.

This means that checking every item in the group means no changes list (e.g. RecentChanges) entries are filtered out.

Definition at line 112 of file ChangesListFilterGroup.php.

Referenced by MediaWiki\RecentChanges\ChangesListFilterGroup\getJsData().

◆ $name

string MediaWiki\RecentChanges\ChangesListFilterGroup::$name
protected

◆ $priority

int MediaWiki\RecentChanges\ChangesListFilterGroup::$priority
protected

Priority integer.

Higher values means higher up in the group list.

Definition at line 97 of file ChangesListFilterGroup.php.

Referenced by MediaWiki\RecentChanges\ChangesListFilterGroup\getJsData(), and MediaWiki\RecentChanges\ChangesListFilterGroup\getPriority().

◆ $title

string MediaWiki\RecentChanges\ChangesListFilterGroup::$title
protected

◆ $type

string MediaWiki\RecentChanges\ChangesListFilterGroup::$type
protected

Type, from a TYPE constant of a subclass.

Definition at line 89 of file ChangesListFilterGroup.php.

Referenced by MediaWiki\RecentChanges\ChangesListFilterGroup\getJsData(), and MediaWiki\RecentChanges\ChangesListFilterGroup\getType().

◆ $whatsThisBody

string null MediaWiki\RecentChanges\ChangesListFilterGroup::$whatsThisBody
protected

i18n key for body of What's This?

Definition at line 68 of file ChangesListFilterGroup.php.

Referenced by MediaWiki\RecentChanges\ChangesListFilterGroup\getJsData().

◆ $whatsThisHeader

string null MediaWiki\RecentChanges\ChangesListFilterGroup::$whatsThisHeader
protected

i18n key for header of What's This?

Definition at line 61 of file ChangesListFilterGroup.php.

Referenced by MediaWiki\RecentChanges\ChangesListFilterGroup\getJsData().

◆ $whatsThisLinkText

string null MediaWiki\RecentChanges\ChangesListFilterGroup::$whatsThisLinkText
protected

i18n key for What's This? link

Definition at line 82 of file ChangesListFilterGroup.php.

Referenced by MediaWiki\RecentChanges\ChangesListFilterGroup\getJsData().

◆ $whatsThisUrl

string null MediaWiki\RecentChanges\ChangesListFilterGroup::$whatsThisUrl
protected

URL of What's This? link.

Definition at line 75 of file ChangesListFilterGroup.php.

Referenced by MediaWiki\RecentChanges\ChangesListFilterGroup\getJsData().


The documentation for this class was generated from the following file: