MediaWiki master
MediaWiki\RecentChanges\ChangesListFilter Class Reference

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

Inherited by MediaWiki\RecentChanges\ChangesListBooleanFilter, and MediaWiki\RecentChanges\ChangesListStringOptionsFilter.

Collaboration diagram for MediaWiki\RecentChanges\ChangesListFilter:

Public Member Functions

 __construct (array $filterDefinition)
 Creates a new filter with the specified configuration, and registers it to the specified group.
 
 activelyInConflictWithFilter (ChangesListFilter $filter, FormOptions $opts)
 Check if the conflict with a filter is currently "active".
 
 activelyInConflictWithGroup (ChangesListFilterGroup $group, FormOptions $opts)
 Check if the conflict with a group is currently "active".
 
 applyCssClassIfNeeded (IContextSource $ctx, RecentChange $rc, array &$classes)
 Add CSS class if needed.
 
 conflictsWith ( $other, string $globalKey, string $forwardKey, string $backwardKey)
 Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object.
 
 displaysOnStructuredUi ()
 Checks whether the filter should display on the structured UI This refers to the exact filter.
 
 displaysOnUnstructuredUi ()
 Checks whether the filter should display on the unstructured UI.
 
 getConflictingFilters ()
 Get filters conflicting with this filter.
 
 getConflictingGroups ()
 Get groups conflicting with this filter.
 
 getDescription ()
 
 getGroup ()
 
 getJsData ()
 Gets the JS data required by the front-end of the structured UI.
 
 getLabel ()
 
 getName ()
 
 getPriority ()
 
 isFeatureAvailableOnStructuredUi ()
 Checks whether an equivalent feature for this filter is available on the structured UI.
 
 isSelected (FormOptions $opts)
 Checks whether this filter is selected in the provided options.
 
 setAsSupersetOf (ChangesListFilter $other)
 Marks that the current instance is (also) a superset of the filter passed in.
 
 setDefaultHighlightColor ( $defaultHighlightColor)
 
 setUnidirectionalConflict ( $other, $globalDescription, $contextDescription)
 Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object.
 

Protected Member Functions

 getCssClass ()
 Gets the CSS class.
 
 getSiblings ()
 Get filters in the same group.
 

Protected Attributes

array $conflictingFilters = []
 Array of associative arrays with conflict information.
 
array $conflictingGroups = []
 Array of associative arrays with conflict information.
 
string null $cssClassSuffix
 CSS class suffix used for attribution, e.g.
 
string $defaultHighlightColor
 
string $description
 i18n key of description for structured UI
 
ChangesListFilterGroup $group
 Group.
 
callable $isRowApplicableCallable
 Callable that returns true if and only if a row is attributed to this filter.
 
string $label
 i18n key of label for structured UI
 
string $name
 Filter name.
 
int $priority
 Priority integer.
 
array $subsetFilters = []
 Array of associative arrays with subset information.
 

Detailed Description

Represents a filter (used on ChangesListSpecialPage and descendants)

Since
1.29
Author
Matthew Flaschen

Definition at line 34 of file ChangesListFilter.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\RecentChanges\ChangesListFilter::__construct ( array $filterDefinition)

Creates a new filter with the specified configuration, and registers it to the specified group.

It infers which UI (it can be either or both) to display the filter on based on which messages are provided.

If 'label' is provided, it will be displayed on the structured UI. Thus, 'label', 'description', and sub-class parameters are optional depending on which UI it's for.

Parameters
array$filterDefinitionChangesListFilter definition
  • $filterDefinition['name'] string Name of filter; use lowercase with no punctuation
  • $filterDefinition['cssClassSuffix'] string CSS class suffix, used to mark that a particular row belongs to this filter (when a row is included by the filter) (optional)
  • $filterDefinition['isRowApplicableCallable'] callable Callable taking two parameters, the IContextSource, and the RecentChange object for the row, and returning true if the row is attributed to this filter. The above CSS class will then be automatically added (optional, required if cssClassSuffix is used).
  • $filterDefinition['group'] ChangesListFilterGroup Group. Filter group this belongs to.
  • $filterDefinition['label'] string i18n key of label for structured UI.
  • $filterDefinition['description'] string i18n key of description for structured UI.
  • $filterDefinition['priority'] int Priority integer. Higher value means higher up in the group's filter list. @phpcs:ignore Generic.Files.LineLength

Definition at line 148 of file ChangesListFilter.php.

Member Function Documentation

◆ activelyInConflictWithFilter()

MediaWiki\RecentChanges\ChangesListFilter::activelyInConflictWithFilter ( ChangesListFilter $filter,
FormOptions $opts )

Check if the conflict with a filter is currently "active".

Parameters
ChangesListFilter$filter
FormOptions$opts
Returns
bool

Definition at line 463 of file ChangesListFilter.php.

References MediaWiki\RecentChanges\ChangesListFilter\isSelected().

◆ activelyInConflictWithGroup()

MediaWiki\RecentChanges\ChangesListFilter::activelyInConflictWithGroup ( ChangesListFilterGroup $group,
FormOptions $opts )

Check if the conflict with a group is currently "active".

Parameters
ChangesListFilterGroup$group
FormOptions$opts
Returns
bool

Definition at line 439 of file ChangesListFilter.php.

References MediaWiki\RecentChanges\ChangesListFilter\$group, MediaWiki\RecentChanges\ChangesListFilterGroup\anySelected(), and MediaWiki\RecentChanges\ChangesListFilter\getSiblings().

◆ applyCssClassIfNeeded()

MediaWiki\RecentChanges\ChangesListFilter::applyCssClassIfNeeded ( IContextSource $ctx,
RecentChange $rc,
array & $classes )

Add CSS class if needed.

Parameters
IContextSource$ctxContext source
RecentChange$rcRecent changes object
array&$classesNon-associative array of CSS class names; appended to if needed

Definition at line 353 of file ChangesListFilter.php.

References MediaWiki\RecentChanges\ChangesListFilter\getCssClass().

◆ conflictsWith()

MediaWiki\RecentChanges\ChangesListFilter::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 200 of file ChangesListFilter.php.

References MediaWiki\RecentChanges\ChangesListFilter\setUnidirectionalConflict().

◆ displaysOnStructuredUi()

MediaWiki\RecentChanges\ChangesListFilter::displaysOnStructuredUi ( )

Checks whether the filter should display on the structured UI This refers to the exact filter.

See also isFeatureAvailableOnStructuredUi.

Returns
bool Whether to display

Definition at line 311 of file ChangesListFilter.php.

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

◆ displaysOnUnstructuredUi()

MediaWiki\RecentChanges\ChangesListFilter::displaysOnUnstructuredUi ( )
abstract

Checks whether the filter should display on the unstructured UI.

Returns
bool Whether to display

Reimplemented in MediaWiki\RecentChanges\ChangesListBooleanFilter, and MediaWiki\RecentChanges\ChangesListStringOptionsFilter.

◆ getConflictingFilters()

MediaWiki\RecentChanges\ChangesListFilter::getConflictingFilters ( )

Get filters conflicting with this filter.

Returns
ChangesListFilter[]

Definition at line 428 of file ChangesListFilter.php.

◆ getConflictingGroups()

MediaWiki\RecentChanges\ChangesListFilter::getConflictingGroups ( )

Get groups conflicting with this filter.

Returns
ChangesListFilterGroup[]

Definition at line 419 of file ChangesListFilter.php.

◆ getCssClass()

MediaWiki\RecentChanges\ChangesListFilter::getCssClass ( )
protected

◆ getDescription()

MediaWiki\RecentChanges\ChangesListFilter::getDescription ( )
Returns
string i18n key of description for structured UI

Definition at line 294 of file ChangesListFilter.php.

References MediaWiki\RecentChanges\ChangesListFilter\$description.

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

◆ getGroup()

MediaWiki\RecentChanges\ChangesListFilter::getGroup ( )

◆ getJsData()

MediaWiki\RecentChanges\ChangesListFilter::getJsData ( )

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

Returns
array Associative array Data required by the front-end. messageKeys is a special top-level value, with the value being an array of the message keys to send to the client.

Reimplemented in MediaWiki\RecentChanges\ChangesListBooleanFilter.

Definition at line 370 of file ChangesListFilter.php.

References MediaWiki\RecentChanges\ChangesListFilter\$defaultHighlightColor, MediaWiki\RecentChanges\ChangesListFilter\$priority, MediaWiki\RecentChanges\ChangesListFilter\$subsetFilters, MediaWiki\RecentChanges\ChangesListFilter\getCssClass(), MediaWiki\RecentChanges\ChangesListFilter\getDescription(), MediaWiki\RecentChanges\ChangesListFilter\getLabel(), and MediaWiki\RecentChanges\ChangesListFilter\getName().

◆ getLabel()

MediaWiki\RecentChanges\ChangesListFilter::getLabel ( )
Returns
string i18n key of label for structured UI

Definition at line 287 of file ChangesListFilter.php.

References MediaWiki\RecentChanges\ChangesListFilter\$label.

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

◆ getName()

◆ getPriority()

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

Definition at line 329 of file ChangesListFilter.php.

References MediaWiki\RecentChanges\ChangesListFilter\$priority.

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

◆ getSiblings()

MediaWiki\RecentChanges\ChangesListFilter::getSiblings ( )
protected

Get filters in the same group.

Returns
ChangesListFilter[]

Definition at line 488 of file ChangesListFilter.php.

Referenced by MediaWiki\RecentChanges\ChangesListFilter\activelyInConflictWithGroup(), and MediaWiki\RecentChanges\ChangesListBooleanFilter\isSelected().

◆ isFeatureAvailableOnStructuredUi()

MediaWiki\RecentChanges\ChangesListFilter::isFeatureAvailableOnStructuredUi ( )

Checks whether an equivalent feature for this filter is available on the structured UI.

This can either be the exact filter, or a new filter that replaces it.

Returns
bool

Reimplemented in MediaWiki\RecentChanges\ChangesListBooleanFilter.

Definition at line 322 of file ChangesListFilter.php.

References MediaWiki\RecentChanges\ChangesListFilter\displaysOnStructuredUi().

◆ isSelected()

MediaWiki\RecentChanges\ChangesListFilter::isSelected ( FormOptions $opts)
abstract

◆ setAsSupersetOf()

MediaWiki\RecentChanges\ChangesListFilter::setAsSupersetOf ( ChangesListFilter $other)

Marks that the current instance is (also) a superset of the filter passed in.

This can be called more than once.

This means that anything in the results for the other filter is also in the results for this one.

Parameters
ChangesListFilter$otherThe filter the current instance is a superset of

Definition at line 257 of file ChangesListFilter.php.

References MediaWiki\RecentChanges\ChangesListFilter\getGroup(), and MediaWiki\RecentChanges\ChangesListFilter\getName().

◆ setDefaultHighlightColor()

MediaWiki\RecentChanges\ChangesListFilter::setDefaultHighlightColor ( $defaultHighlightColor)
Parameters
string$defaultHighlightColor

Definition at line 500 of file ChangesListFilter.php.

◆ setUnidirectionalConflict()

MediaWiki\RecentChanges\ChangesListFilter::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 225 of file ChangesListFilter.php.

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

Member Data Documentation

◆ $conflictingFilters

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

Array of associative arrays with conflict information.

See setUnidirectionalConflict

Definition at line 94 of file ChangesListFilter.php.

◆ $conflictingGroups

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

Array of associative arrays with conflict information.

See setUnidirectionalConflict

Definition at line 86 of file ChangesListFilter.php.

◆ $cssClassSuffix

string null MediaWiki\RecentChanges\ChangesListFilter::$cssClassSuffix
protected

CSS class suffix used for attribution, e.g.

'bot'.

In this example, if bot actions are included in the result set, this CSS class will then be included in all bot-flagged actions.

Definition at line 50 of file ChangesListFilter.php.

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

◆ $defaultHighlightColor

string MediaWiki\RecentChanges\ChangesListFilter::$defaultHighlightColor
protected

◆ $description

string MediaWiki\RecentChanges\ChangesListFilter::$description
protected

i18n key of description for structured UI

Definition at line 78 of file ChangesListFilter.php.

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

◆ $group

ChangesListFilterGroup MediaWiki\RecentChanges\ChangesListFilter::$group
protected

Group.

ChangesListFilterGroup this belongs to

Definition at line 64 of file ChangesListFilter.php.

Referenced by MediaWiki\RecentChanges\ChangesListFilter\activelyInConflictWithGroup(), and MediaWiki\RecentChanges\ChangesListFilter\getGroup().

◆ $isRowApplicableCallable

callable MediaWiki\RecentChanges\ChangesListFilter::$isRowApplicableCallable
protected

Callable that returns true if and only if a row is attributed to this filter.

Definition at line 57 of file ChangesListFilter.php.

◆ $label

string MediaWiki\RecentChanges\ChangesListFilter::$label
protected

i18n key of label for structured UI

Definition at line 71 of file ChangesListFilter.php.

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

◆ $name

string MediaWiki\RecentChanges\ChangesListFilter::$name
protected

Filter name.

Definition at line 40 of file ChangesListFilter.php.

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

◆ $priority

int MediaWiki\RecentChanges\ChangesListFilter::$priority
protected

Priority integer.

Higher value means higher up in the group's filter list.

Definition at line 108 of file ChangesListFilter.php.

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

◆ $subsetFilters

array MediaWiki\RecentChanges\ChangesListFilter::$subsetFilters = []
protected

Array of associative arrays with subset information.

Definition at line 101 of file ChangesListFilter.php.

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


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