MediaWiki master
MediaWiki\RecentChanges\ChangesListBooleanFilter Class Reference

Represents a hide-based boolean filter (used on ChangesListSpecialPage and descendants) More...

Inherits MediaWiki\RecentChanges\ChangesListFilter.

Collaboration diagram for MediaWiki\RecentChanges\ChangesListBooleanFilter:

Public Member Functions

 __construct ( $filterDefinition)
 Create a new filter with the specified configuration.
 
 displaysOnUnstructuredUi ()
 Checks whether the filter should display on the unstructured UI.
Returns
bool Whether to display

 
 getDefault ( $structuredUI=false)
 Get the default value.
 
 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.

 
 getShowHide ()
 
 isActive (FormOptions $opts, $isStructuredUI)
 
Parameters
FormOptions$optsQuery parameters merged with defaults
bool$isStructuredUIWhether the structured UI is currently enabled
Returns
bool Whether this filter should be considered active

 
 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

 
 isSelected (FormOptions $opts)
 Checks whether this filter is selected in the provided options.
Parameters
FormOptions$opts
Returns
bool

 
 modifyQuery (IReadableDatabase $dbr, ChangesListSpecialPage $specialPage, &$tables, &$fields, &$conds, &$query_options, &$join_conds)
 Modifies the query to include the filter.
 
 setDefault ( $defaultValue)
 Sets default.
 
- Public Member Functions inherited from MediaWiki\RecentChanges\ChangesListFilter
 __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.
 
 getAction ()
 Get the action to apply to the ChangesListQuery for filtering.
 
 getConflictingFilters ()
 Get filters conflicting with this filter.
 
 getConflictingGroups ()
 Get groups conflicting with this filter.
 
 getCssClass ()
 Gets the CSS class.
 
 getDescription ()
 
 getGroup ()
 
 getHighlightAction ()
 Get the action to apply to the ChangesListQuery for highlighting.
 
 getLabel ()
 
 getName ()
 
 getPriority ()
 
 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 Attributes

bool $activeValue
 Value that defined when this filter is considered active.
 
bool $defaultValue
 Default.
 
bool $isReplacedInStructuredUi
 Whether there is a feature designed to replace this filter available on the structured UI.
 
callable $queryCallable
 Callable used to do the actual query modification; see constructor.
 
string $showHide
 Main unstructured UI i18n key.
 
- Protected Attributes inherited from MediaWiki\RecentChanges\ChangesListFilter
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 null $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.
 

Additional Inherited Members

- Protected Member Functions inherited from MediaWiki\RecentChanges\ChangesListFilter
 getSiblings ()
 Get filters in the same group.
 

Detailed Description

Represents a hide-based boolean filter (used on ChangesListSpecialPage and descendants)

Since
1.29
Author
Matthew Flaschen

Definition at line 21 of file ChangesListBooleanFilter.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\RecentChanges\ChangesListBooleanFilter::__construct ( $filterDefinition)

Create a new filter with the specified configuration.

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. If 'showHide' is provided, it will be displayed on the unstructured UI. Thus, 'label', 'description', and 'showHide' are optional depending on which UI it's for.

Parameters
array$filterDefinitionChangesListFilter definition
  • $filterDefinition['name'] string Name. Used as URL parameter.
  • $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['showHide'] string Main i18n key used for unstructured UI.
  • $filterDefinition['isReplacedInStructuredUi'] bool Whether there is an equivalent feature available in the structured UI; this is optional, defaulting to true. It does not need to be set if the exact same filter is simply visible on both.
  • $filterDefinition['default'] bool Default
  • $filterDefinition['activeValue'] bool This filter is considered active when its value is equal to its activeValue. Default is true.
  • $filterDefinition['priority'] int Priority integer. Higher value means higher up in the group's filter list.
  • $filterDefinition['queryCallable'] callable Callable accepting parameters, used to implement filter's DB query modification. Required, except for legacy filters that still use the query hooks directly. Callback parameters:
    • string $specialPageClassName Class name of current special page
    • IContextSource $context Context, for e.g. user
    • IDatabase $dbr Database, for addQuotes, makeList, and similar
    • array &$tables Array of tables; see IDatabase::select $table
    • array &$fields Array of fields; see IDatabase::select $vars
    • array &$conds Array of conditions; see IDatabase::select $conds
    • array &$query_options Array of query options; see IDatabase::select $options
    • array &$join_conds Array of join conditions; see IDatabase::select $join_conds

Definition at line 98 of file ChangesListBooleanFilter.php.

References MediaWiki\RecentChanges\ChangesListBooleanFilter\setDefault().

Member Function Documentation

◆ displaysOnUnstructuredUi()

MediaWiki\RecentChanges\ChangesListBooleanFilter::displaysOnUnstructuredUi ( )

Checks whether the filter should display on the unstructured UI.

Returns
bool Whether to display

Reimplemented from MediaWiki\RecentChanges\ChangesListFilter.

Definition at line 153 of file ChangesListBooleanFilter.php.

References MediaWiki\RecentChanges\ChangesListBooleanFilter\$showHide.

◆ getDefault()

MediaWiki\RecentChanges\ChangesListBooleanFilter::getDefault ( $structuredUI = false)

Get the default value.

Parameters
bool$structuredUIAre we currently showing the structured UI
Returns
bool|null Default value

Definition at line 126 of file ChangesListBooleanFilter.php.

References MediaWiki\RecentChanges\ChangesListBooleanFilter\$defaultValue.

◆ getJsData()

MediaWiki\RecentChanges\ChangesListBooleanFilter::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 from MediaWiki\RecentChanges\ChangesListFilter.

Definition at line 199 of file ChangesListBooleanFilter.php.

References MediaWiki\RecentChanges\ChangesListBooleanFilter\$defaultValue.

◆ getShowHide()

MediaWiki\RecentChanges\ChangesListBooleanFilter::getShowHide ( )
Returns
string Main i18n key for unstructured UI

Definition at line 146 of file ChangesListBooleanFilter.php.

References MediaWiki\RecentChanges\ChangesListBooleanFilter\$showHide.

◆ isActive()

MediaWiki\RecentChanges\ChangesListBooleanFilter::isActive ( FormOptions $opts,
$isStructuredUI )

Parameters
FormOptions$optsQuery parameters merged with defaults
bool$isStructuredUIWhether the structured UI is currently enabled
Returns
bool Whether this filter should be considered active

Reimplemented from MediaWiki\RecentChanges\ChangesListFilter.

Definition at line 223 of file ChangesListBooleanFilter.php.

References MediaWiki\RecentChanges\ChangesListBooleanFilter\$activeValue, and MediaWiki\RecentChanges\ChangesListFilter\getName().

◆ isFeatureAvailableOnStructuredUi()

MediaWiki\RecentChanges\ChangesListBooleanFilter::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 from MediaWiki\RecentChanges\ChangesListFilter.

Definition at line 160 of file ChangesListBooleanFilter.php.

◆ isSelected()

MediaWiki\RecentChanges\ChangesListBooleanFilter::isSelected ( FormOptions $opts)

Checks whether this filter is selected in the provided options.

Parameters
FormOptions$opts
Returns
bool

Reimplemented from MediaWiki\RecentChanges\ChangesListFilter.

Definition at line 210 of file ChangesListBooleanFilter.php.

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

◆ modifyQuery()

MediaWiki\RecentChanges\ChangesListBooleanFilter::modifyQuery ( IReadableDatabase $dbr,
ChangesListSpecialPage $specialPage,
& $tables,
& $fields,
& $conds,
& $query_options,
& $join_conds )

Modifies the query to include the filter.

This is only called if the filter is in effect (taking into account the default).

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

Definition at line 177 of file ChangesListBooleanFilter.php.

References MediaWiki\RecentChanges\ChangesListBooleanFilter\$queryCallable, and MediaWiki\SpecialPage\SpecialPage\getContext().

◆ setDefault()

MediaWiki\RecentChanges\ChangesListBooleanFilter::setDefault ( $defaultValue)

Sets default.

It must be a boolean.

It will be coerced to boolean.

Parameters
bool$defaultValue

Definition at line 139 of file ChangesListBooleanFilter.php.

References MediaWiki\RecentChanges\ChangesListBooleanFilter\$defaultValue.

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

Member Data Documentation

◆ $activeValue

bool MediaWiki\RecentChanges\ChangesListBooleanFilter::$activeValue
protected

Value that defined when this filter is considered active.

Definition at line 56 of file ChangesListBooleanFilter.php.

Referenced by MediaWiki\RecentChanges\ChangesListBooleanFilter\isActive().

◆ $defaultValue

bool MediaWiki\RecentChanges\ChangesListBooleanFilter::$defaultValue
protected

◆ $isReplacedInStructuredUi

bool MediaWiki\RecentChanges\ChangesListBooleanFilter::$isReplacedInStructuredUi
protected

Whether there is a feature designed to replace this filter available on the structured UI.

Definition at line 35 of file ChangesListBooleanFilter.php.

◆ $queryCallable

callable MediaWiki\RecentChanges\ChangesListBooleanFilter::$queryCallable
protected

Callable used to do the actual query modification; see constructor.

Definition at line 49 of file ChangesListBooleanFilter.php.

Referenced by MediaWiki\RecentChanges\ChangesListBooleanFilter\modifyQuery().

◆ $showHide

string MediaWiki\RecentChanges\ChangesListBooleanFilter::$showHide
protected

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