MediaWiki  1.29.1
ChangesListFilterGroup Class Reference

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

Inheritance diagram for ChangesListFilterGroup:

Public Member Functions

 __construct (array $groupDefinition)
 Create a new filter group with the specified configuration. More...
 
 anySelected (FormOptions $opts)
 Check if any filter in this group is selected. More...
 
 conflictsWith ( $other, $globalKey, $forwardKey, $backwardKey)
 Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object. More...
 
 getConflictingFilters ()
 Get filters conflicting with this filter group. More...
 
 getConflictingGroups ()
 Get groups conflicting with this filter group. More...
 
 getFilter ( $name)
 Get filter by name. More...
 
 getFilters ()
 
 getJsData ()
 Gets the JS data in the format required by the front-end of the structured UI. More...
 
 getName ()
 
 getPriority ()
 
 getTitle ()
 
 getType ()
 
 isPerGroupRequestParameter ()
 Check whether the URL parameter is for the group, or for individual filters. More...
 
 setUnidirectionalConflict ( $other, $globalDescription, $contextDescription)
 Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object. More...
 

Public Attributes

const DEFAULT_PRIORITY = -100
 
const RESERVED_NAME_CHAR = '_'
 

Protected Member Functions

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

Protected Attributes

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

Detailed Description

Represents a filter group (used on ChangesListSpecialPage and descendants)

Since
1.29

Definition at line 35 of file ChangesListFilterGroup.php.

Constructor & Destructor Documentation

◆ __construct()

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.

Reimplemented in ChangesListStringOptionsFilterGroup, and ChangesListBooleanFilterGroup.

Definition at line 146 of file ChangesListFilterGroup.php.

References as, createFilter(), DEFAULT_PRIORITY, name, title, and type.

Member Function Documentation

◆ anySelected()

ChangesListFilterGroup::anySelected ( FormOptions  $opts)

Check if any filter in this group is selected.

Parameters
FormOptions$opts
Returns
bool

Definition at line 441 of file ChangesListFilterGroup.php.

References captcha-old\count, getFilters(), ChangesListFilter\isSelected(), and use.

◆ conflictsWith()

ChangesListFilterGroup::conflictsWith (   $other,
  $globalKey,
  $forwardKey,
  $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$otherOther ChangesListFilterGroup or ChangesListFilter
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 224 of file ChangesListFilterGroup.php.

References setUnidirectionalConflict().

◆ createFilter()

ChangesListFilterGroup::createFilter ( array  $filterDefinition)
abstractprotected

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

Parameters
array$filterDefinitionFilter definition
Returns
ChangesListFilter Filter

Reimplemented in ChangesListStringOptionsFilterGroup, ChangesListBooleanFilterGroup, and MockChangesListFilterGroup.

Referenced by __construct().

◆ getConflictingFilters()

ChangesListFilterGroup::getConflictingFilters ( )

Get filters conflicting with this filter group.

Returns
ChangesListFilter[]

Definition at line 426 of file ChangesListFilterGroup.php.

References $conflictingFilters.

◆ getConflictingGroups()

ChangesListFilterGroup::getConflictingGroups ( )

Get groups conflicting with this filter group.

Returns
ChangesListFilterGroup[]

Definition at line 412 of file ChangesListFilterGroup.php.

References $conflictingGroups.

◆ getFilter()

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 322 of file ChangesListFilterGroup.php.

References $name.

◆ getFilters()

ChangesListFilterGroup::getFilters ( )
Returns
array Associative array of ChangesListFilter objects, with filter name as key

Definition at line 312 of file ChangesListFilterGroup.php.

References $filters.

Referenced by anySelected().

◆ getJsData()

ChangesListFilterGroup::getJsData ( )

Gets the JS data in the format required by the front-end of the structured UI.

Returns
array|null Associative array, or null if there are no filters that display in the structured UI. messageKeys is a special top-level value, with the value being an array of the message keys to send to the client.

Reimplemented in ChangesListStringOptionsFilterGroup.

Definition at line 341 of file ChangesListFilterGroup.php.

References $isFullCoverage, $name, $output, $priority, $title, $type, $whatsThisBody, $whatsThisHeader, $whatsThisLinkText, $whatsThisUrl, as, and captcha-old\count.

◆ getName()

ChangesListFilterGroup::getName ( )
Returns
string Internal name

Definition at line 284 of file ChangesListFilterGroup.php.

References $name.

Referenced by ChangesListSpecialPage\registerFilterGroup().

◆ getPriority()

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

Definition at line 305 of file ChangesListFilterGroup.php.

References $priority.

◆ getTitle()

ChangesListFilterGroup::getTitle ( )
Returns
string i18n key for title

Definition at line 291 of file ChangesListFilterGroup.php.

References $title.

◆ getType()

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

Definition at line 298 of file ChangesListFilterGroup.php.

References $type.

◆ isPerGroupRequestParameter()

ChangesListFilterGroup::isPerGroupRequestParameter ( )
abstract

Check whether the URL parameter is for the group, or for individual filters.

Defaults can also be defined on the group if and only if this is true.

Returns
bool True if and only if the URL parameter is per-group

Reimplemented in ChangesListStringOptionsFilterGroup, ChangesListBooleanFilterGroup, and MockChangesListFilterGroup.

◆ setUnidirectionalConflict()

ChangesListFilterGroup::setUnidirectionalConflict (   $other,
  $globalDescription,
  $contextDescription 
)

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

Internal use ONLY.

Parameters
ChangesListFilterGroup | ChangesListFilter$otherOther ChangesListFilterGroup or ChangesListFilter
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 conflictsWith().

Member Data Documentation

◆ $conflictingFilters

ChangesListFilterGroup::$conflictingFilters = []
protected

Definition at line 122 of file ChangesListFilterGroup.php.

Referenced by getConflictingFilters().

◆ $conflictingGroups

ChangesListFilterGroup::$conflictingGroups = []
protected

Definition at line 114 of file ChangesListFilterGroup.php.

Referenced by getConflictingGroups().

◆ $filters

array ChangesListFilterGroup::$filters
protected

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

Definition at line 98 of file ChangesListFilterGroup.php.

Referenced by getFilters().

◆ $isFullCoverage

bool 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 106 of file ChangesListFilterGroup.php.

Referenced by getJsData().

◆ $name

string ChangesListFilterGroup::$name
protected

Name (internal identifier)

Definition at line 41 of file ChangesListFilterGroup.php.

Referenced by getFilter(), getJsData(), and getName().

◆ $priority

string ChangesListFilterGroup::$priority
protected

Priority integer.

Higher values means higher up in the group list.

Definition at line 91 of file ChangesListFilterGroup.php.

Referenced by getJsData(), and getPriority().

◆ $title

string ChangesListFilterGroup::$title
protected

i18n key for title

Definition at line 48 of file ChangesListFilterGroup.php.

Referenced by getJsData(), and getTitle().

◆ $type

string ChangesListFilterGroup::$type
protected

Type, from a TYPE constant of a subclass.

Definition at line 83 of file ChangesListFilterGroup.php.

Referenced by getJsData(), and getType().

◆ $whatsThisBody

string null ChangesListFilterGroup::$whatsThisBody
protected

i18n key for body of What's This?

Definition at line 62 of file ChangesListFilterGroup.php.

Referenced by getJsData().

◆ $whatsThisHeader

string null ChangesListFilterGroup::$whatsThisHeader
protected

i18n key for header of What's This?

Definition at line 55 of file ChangesListFilterGroup.php.

Referenced by getJsData().

◆ $whatsThisLinkText

string null ChangesListFilterGroup::$whatsThisLinkText
protected

i18n key for What's This? link

Definition at line 76 of file ChangesListFilterGroup.php.

Referenced by getJsData().

◆ $whatsThisUrl

string null ChangesListFilterGroup::$whatsThisUrl
protected

URL of What's This? link.

Definition at line 69 of file ChangesListFilterGroup.php.

Referenced by getJsData().

◆ DEFAULT_PRIORITY

const ChangesListFilterGroup::DEFAULT_PRIORITY = -100

Definition at line 124 of file ChangesListFilterGroup.php.

Referenced by __construct().

◆ RESERVED_NAME_CHAR

const ChangesListFilterGroup::RESERVED_NAME_CHAR = '_'

Definition at line 126 of file ChangesListFilterGroup.php.


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