MediaWiki  master
ChangesListStringOptionsFilterGroup Class Reference

Represents a filter group with multiple string options. More...

Inheritance diagram for ChangesListStringOptionsFilterGroup:
Collaboration diagram for ChangesListStringOptionsFilterGroup:

Public Member Functions

 __construct (array $groupDefinition)
 Create a new filter group with the specified configuration. More...
 
 addOptions (FormOptions $opts, $allowDefaults, $isStructuredFiltersEnabled)
 
 getDefault ()
 Gets default of filter group. More...
 
 getJsData ()
 
 modifyQuery (IDatabase $dbr, ChangesListSpecialPage $specialPage, &$tables, &$fields, &$conds, &$query_options, &$join_conds, FormOptions $opts, $isStructuredFiltersEnabled)
 
 registerFilter (ChangesListStringOptionsFilter $filter)
 Registers a filter in this group. More...
 
 setDefault ( $defaultValue)
 Sets default of filter group. More...
 
- Public Member Functions inherited from ChangesListFilterGroup
 __construct (array $groupDefinition)
 Create a new filter group with the specified configuration. More...
 
 addOptions (FormOptions $opts, $allowDefaults, $isStructuredFiltersEnabled)
 All the options represented by this filter group to $opts. 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 ()
 
 modifyQuery (IDatabase $dbr, ChangesListSpecialPage $specialPage, &$tables, &$fields, &$conds, &$query_options, &$join_conds, FormOptions $opts, $isStructuredFiltersEnabled)
 Modifies the query to include the filter group. More...
 
 setUnidirectionalConflict ( $other, $globalDescription, $contextDescription)
 Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object. More...
 

Public Attributes

const ALL = 'all'
 Signifies that all options in the group are selected. More...
 
const NONE = ''
 Signifies that no options in the group are selected, meaning the group has no effect. More...
 
const SEPARATOR = ';'
 Delimiter. More...
 
const TYPE = 'string_options'
 Type marker, used by JavaScript. More...
 
- Public Attributes inherited from ChangesListFilterGroup
const DEFAULT_PRIORITY = -100
 
const RESERVED_NAME_CHAR = '_'
 

Protected Member Functions

 createFilter (array $filterDefinition)
 
- Protected Member Functions inherited from ChangesListFilterGroup
 createFilter (array $filterDefinition)
 Creates a filter of the appropriate type for this group, from the definition. More...
 

Protected Attributes

 $defaultValue
 Defaul parameter value. More...
 
 $queryCallable
 Callable used to do the actual query modification; see constructor. More...
 
- Protected Attributes inherited from ChangesListFilterGroup
 $conflictingFilters = []
 Array of associative arrays with conflict information. More...
 
 $conflictingGroups = []
 Array of associative arrays with conflict information. More...
 
 $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...
 

Private Member Functions

 isActive ( $isStructuredUI)
 Check if this filter group is currently active. More...
 

Detailed Description

Represents a filter group with multiple string options.

They are passed to the server as a single form parameter separated by a delimiter. The parameter name is the group name. E.g. groupname=opt1;opt2 .

If all options are selected they are replaced by the term "all".

There is also a single DB query modification for the whole group.

Since
1.29

Definition at line 37 of file ChangesListStringOptionsFilterGroup.php.

Constructor & Destructor Documentation

◆ __construct()

ChangesListStringOptionsFilterGroup::__construct ( array  $groupDefinition)

Create a new filter group with the specified configuration.

Parameters
array$groupDefinitionConfiguration of group
  • $groupDefinition['name'] string Group name
  • $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['priority'] int Priority integer. Higher means higher in the group list.
  • $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['default'] string Default for group.
  • $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['queryCallable'] callable Callable accepting 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
    • array $selectedValues The allowed and requested values, lower-cased and sorted
  • $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).

Definition at line 111 of file ChangesListStringOptionsFilterGroup.php.

References setDefault().

Member Function Documentation

◆ addOptions()

ChangesListStringOptionsFilterGroup::addOptions ( FormOptions  $opts,
  $allowDefaults,
  $isStructuredFiltersEnabled 
)

◆ createFilter()

ChangesListStringOptionsFilterGroup::createFilter ( array  $filterDefinition)
protected

Definition at line 150 of file ChangesListStringOptionsFilterGroup.php.

◆ getDefault()

ChangesListStringOptionsFilterGroup::getDefault ( )

Gets default of filter group.

Returns
string $defaultValue

Definition at line 143 of file ChangesListStringOptionsFilterGroup.php.

References $defaultValue.

Referenced by addOptions(), and getJsData().

◆ getJsData()

ChangesListStringOptionsFilterGroup::getJsData ( )

Definition at line 220 of file ChangesListStringOptionsFilterGroup.php.

References getDefault().

◆ isActive()

ChangesListStringOptionsFilterGroup::isActive (   $isStructuredUI)
private

Check if this filter group is currently active.

Parameters
bool$isStructuredUIIs structured filters UI current enabled
Returns
bool

Definition at line 242 of file ChangesListStringOptionsFilterGroup.php.

Referenced by modifyQuery().

◆ modifyQuery()

ChangesListStringOptionsFilterGroup::modifyQuery ( IDatabase  $dbr,
ChangesListSpecialPage  $specialPage,
$tables,
$fields,
$conds,
$query_options,
$join_conds,
FormOptions  $opts,
  $isStructuredFiltersEnabled 
)

◆ registerFilter()

ChangesListStringOptionsFilterGroup::registerFilter ( ChangesListStringOptionsFilter  $filter)

Registers a filter in this group.

Parameters
ChangesListStringOptionsFilter$filterPhanParamSignaturePHPDocMismatchHasParamType,PhanParamSignatureMismatch

Definition at line 160 of file ChangesListStringOptionsFilterGroup.php.

References $filter, and ChangesListFilter\getName().

◆ setDefault()

ChangesListStringOptionsFilterGroup::setDefault (   $defaultValue)

Sets default of filter group.

Parameters
string$defaultValue

Definition at line 134 of file ChangesListStringOptionsFilterGroup.php.

References $defaultValue.

Referenced by __construct().

Member Data Documentation

◆ $defaultValue

string ChangesListStringOptionsFilterGroup::$defaultValue
protected

Defaul parameter value.

Definition at line 66 of file ChangesListStringOptionsFilterGroup.php.

Referenced by getDefault(), and setDefault().

◆ $queryCallable

callable ChangesListStringOptionsFilterGroup::$queryCallable
protected

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

Definition at line 73 of file ChangesListStringOptionsFilterGroup.php.

Referenced by modifyQuery().

◆ ALL

const ChangesListStringOptionsFilterGroup::ALL = 'all'

Signifies that all options in the group are selected.

Definition at line 51 of file ChangesListStringOptionsFilterGroup.php.

Referenced by ChangesListStringOptionsFilter\isSelected().

◆ NONE

const ChangesListStringOptionsFilterGroup::NONE = ''

Signifies that no options in the group are selected, meaning the group has no effect.

For full-coverage groups, this is the same as ALL if all filters are allowed. For others, it is not.

Definition at line 59 of file ChangesListStringOptionsFilterGroup.php.

Referenced by SpecialRecentChanges\__construct(), ChangesListSpecialPage\__construct(), and SpecialWatchlist\registerFilters().

◆ SEPARATOR

const ChangesListStringOptionsFilterGroup::SEPARATOR = ';'

◆ TYPE

const ChangesListStringOptionsFilterGroup::TYPE = 'string_options'

Type marker, used by JavaScript.

Definition at line 41 of file ChangesListStringOptionsFilterGroup.php.


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