MediaWiki  1.29.1
ChangesListFilter Class Reference

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

Inheritance diagram for ChangesListFilter:

Public Member Functions

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

Public Attributes

const RESERVED_NAME_CHAR = '_'
 

Protected Member Functions

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

Protected Attributes

 $conflictingFilters = []
 
 $conflictingGroups = []
 
 $cssClassSuffix
 CSS class suffix used for attribution, e.g. More...
 
 $description
 i18n key of description for structured UI More...
 
 $group
 Group. More...
 
 $isRowApplicableCallable
 Callable that returns true if and only if a row is attributed to this filter. More...
 
 $label
 i18n key of label for structured UI More...
 
 $name
 Filter name. More...
 
 $priority
 Priority integer. More...
 
 $subsetFilters = []
 

Private Member Functions

 hasConflictWithFilter (ChangeslistFilter $filter)
 
 hasConflictWithGroup (ChangesListFilterGroup $group)
 

Detailed Description

Represents a filter (used on ChangesListSpecialPage and descendants)

Since
1.29

Definition at line 30 of file ChangesListFilter.php.

Constructor & Destructor Documentation

◆ __construct()

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 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.

Definition at line 138 of file ChangesListFilter.php.

References group, and name.

Member Function Documentation

◆ activelyInConflictWithFilter()

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 470 of file ChangesListFilter.php.

References as, getSiblings(), and isSelected().

◆ activelyInConflictWithGroup()

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 446 of file ChangesListFilter.php.

References $group, as, getSiblings(), and isSelected().

◆ applyCssClassIfNeeded()

ChangesListFilter::applyCssClassIfNeeded ( IContextSource  $ctx,
RecentChange  $rc,
array $classes 
)

Add CSS class if needed.

Parameters
IContextSource$ctxContext source
RecentChange$rcRecent changes object
Non-associativearray of CSS class names; appended to if needed

Definition at line 351 of file ChangesListFilter.php.

References getCssClass().

◆ conflictsWith()

ChangesListFilter::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 190 of file ChangesListFilter.php.

References setUnidirectionalConflict().

◆ displaysOnStructuredUi()

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 310 of file ChangesListFilter.php.

Referenced by isFeatureAvailableOnStructuredUi().

◆ displaysOnUnstructuredUi()

ChangesListFilter::displaysOnUnstructuredUi ( )
abstract

Checks whether the filter should display on the unstructured UI.

Returns
bool Whether to display

Reimplemented in ChangesListBooleanFilter, ChangesListStringOptionsFilter, and MockChangesListFilter.

◆ getConflictingFilters()

ChangesListFilter::getConflictingFilters ( )

Get filters conflicting with this filter.

Returns
ChangesListFilter[]

Definition at line 430 of file ChangesListFilter.php.

References $conflictingFilters.

Referenced by hasConflictWithFilter().

◆ getConflictingGroups()

ChangesListFilter::getConflictingGroups ( )

Get groups conflicting with this filter.

Returns
ChangesListFilterGroup[]

Definition at line 416 of file ChangesListFilter.php.

References $conflictingGroups.

Referenced by hasConflictWithGroup().

◆ getCssClass()

ChangesListFilter::getCssClass ( )
protected

Gets the CSS class.

Returns
string|null CSS class, or null if not defined

Definition at line 336 of file ChangesListFilter.php.

References $cssClassSuffix, and ChangesList\CSS_CLASS_PREFIX.

Referenced by applyCssClassIfNeeded(), and getJsData().

◆ getDescription()

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

Definition at line 293 of file ChangesListFilter.php.

References $description.

Referenced by getJsData().

◆ getGroup()

ChangesListFilter::getGroup ( )
Returns
ChangesListFilterGroup Group this belongs to

Definition at line 279 of file ChangesListFilter.php.

References $group.

Referenced by getSiblings(), ChangesListStringOptionsFilter\isSelected(), and setAsSupersetOf().

◆ getJsData()

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 ChangesListBooleanFilter.

Definition at line 368 of file ChangesListFilter.php.

References $output, $priority, $subsetFilters, as, getCssClass(), getDescription(), getLabel(), and getName().

◆ getLabel()

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

Definition at line 286 of file ChangesListFilter.php.

References $label.

Referenced by getJsData().

◆ getName()

◆ getPriority()

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

Definition at line 327 of file ChangesListFilter.php.

References $priority.

◆ getSiblings()

ChangesListFilter::getSiblings ( )
protected

Get filters in the same group.

Returns
ChangesListFilter[]

Definition at line 495 of file ChangesListFilter.php.

References getGroup().

Referenced by activelyInConflictWithFilter(), activelyInConflictWithGroup(), and ChangesListBooleanFilter\isSelected().

◆ hasConflictWithFilter()

ChangesListFilter::hasConflictWithFilter ( ChangeslistFilter  $filter)
private

Definition at line 486 of file ChangesListFilter.php.

References getConflictingFilters().

◆ hasConflictWithGroup()

ChangesListFilter::hasConflictWithGroup ( ChangesListFilterGroup  $group)
private

Definition at line 459 of file ChangesListFilter.php.

References $group, and getConflictingGroups().

◆ isFeatureAvailableOnStructuredUi()

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.

Reimplemented in ChangesListBooleanFilter.

Definition at line 320 of file ChangesListFilter.php.

References displaysOnStructuredUi().

◆ isSelected()

ChangesListFilter::isSelected ( FormOptions  $opts)
abstract

Checks whether this filter is selected in the provided options.

Parameters
FormOptions$opts
Returns
bool

Reimplemented in ChangesListBooleanFilter, ChangesListStringOptionsFilter, and MockChangesListFilter.

Referenced by activelyInConflictWithFilter(), activelyInConflictWithGroup(), and ChangesListFilterGroup\anySelected().

◆ setAsSupersetOf()

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
ChangesListFilterThe filter the current instance is a superset of

Definition at line 256 of file ChangesListFilter.php.

References getGroup(), and getName().

◆ setUnidirectionalConflict()

ChangesListFilter::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 224 of file ChangesListFilter.php.

Referenced by conflictsWith().

Member Data Documentation

◆ $conflictingFilters

ChangesListFilter::$conflictingFilters = []
protected

Definition at line 90 of file ChangesListFilter.php.

Referenced by getConflictingFilters().

◆ $conflictingGroups

ChangesListFilter::$conflictingGroups = []
protected

Definition at line 82 of file ChangesListFilter.php.

Referenced by getConflictingGroups().

◆ $cssClassSuffix

string null 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 46 of file ChangesListFilter.php.

Referenced by getCssClass().

◆ $description

string ChangesListFilter::$description
protected

i18n key of description for structured UI

Definition at line 74 of file ChangesListFilter.php.

Referenced by getDescription().

◆ $group

ChangesListFilterGroup ChangesListFilter::$group
protected

Group.

ChangesListFilterGroup this belongs to

Definition at line 60 of file ChangesListFilter.php.

Referenced by activelyInConflictWithGroup(), getGroup(), and hasConflictWithGroup().

◆ $isRowApplicableCallable

callable ChangesListFilter::$isRowApplicableCallable
protected

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

Definition at line 53 of file ChangesListFilter.php.

◆ $label

string ChangesListFilter::$label
protected

i18n key of label for structured UI

Definition at line 67 of file ChangesListFilter.php.

Referenced by getLabel().

◆ $name

string ChangesListFilter::$name
protected

Filter name.

Definition at line 36 of file ChangesListFilter.php.

Referenced by getName().

◆ $priority

string ChangesListFilter::$priority
protected

Priority integer.

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

Definition at line 104 of file ChangesListFilter.php.

Referenced by getJsData(), and getPriority().

◆ $subsetFilters

ChangesListFilter::$subsetFilters = []
protected

Definition at line 97 of file ChangesListFilter.php.

Referenced by getJsData().

◆ RESERVED_NAME_CHAR

const ChangesListFilter::RESERVED_NAME_CHAR = '_'

Definition at line 106 of file ChangesListFilter.php.


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