155 if ( strpos( $groupDefinition[
'name'], self::RESERVED_NAME_CHAR ) !==
false ) {
156 throw new MWException(
'Group names may not contain \'' .
157 self::RESERVED_NAME_CHAR .
158 '\'. Use the naming convention: \
'camelCase\''
162 $this->name = $groupDefinition[
'name'];
164 if ( isset( $groupDefinition[
'title'] ) ) {
165 $this->title = $groupDefinition[
'title'];
168 if ( isset( $groupDefinition[
'whatsThisHeader'] ) ) {
169 $this->whatsThisHeader = $groupDefinition[
'whatsThisHeader'];
170 $this->whatsThisBody = $groupDefinition[
'whatsThisBody'];
171 $this->whatsThisUrl = $groupDefinition[
'whatsThisUrl'];
172 $this->whatsThisLinkText = $groupDefinition[
'whatsThisLinkText'];
175 $this->
type = $groupDefinition[
'type'];
176 if ( isset( $groupDefinition[
'priority'] ) ) {
177 $this->priority = $groupDefinition[
'priority'];
182 $this->isFullCoverage = $groupDefinition[
'isFullCoverage'];
185 $lowestSpecifiedPriority = -1;
186 foreach ( $groupDefinition[
'filters'] as $filterDefinition ) {
187 if ( isset( $filterDefinition[
'priority'] ) ) {
188 $lowestSpecifiedPriority = min( $lowestSpecifiedPriority, $filterDefinition[
'priority'] );
196 $autoFillPriority = $lowestSpecifiedPriority - 1;
197 foreach ( $groupDefinition[
'filters'] as $filterDefinition ) {
198 if ( !isset( $filterDefinition[
'priority'] ) ) {
199 $filterDefinition[
'priority'] = $autoFillPriority;
202 $filterDefinition[
'group'] = $this;
205 $this->registerFilter( $filter );
232 public function conflictsWith( $other, $globalKey, $forwardKey, $backwardKey ) {
233 if ( $globalKey ===
null || $forwardKey ===
null || $backwardKey ===
null ) {
234 throw new MWException(
'All messages must be specified' );
243 $other->setUnidirectionalConflict(
264 $this->conflictingGroups[] = [
265 'group' => $other->getName(),
266 'groupObject' => $other,
267 'globalDescription' => $globalDescription,
268 'contextDescription' => $contextDescription,
271 $this->conflictingFilters[] = [
272 'group' => $other->getGroup()->getName(),
273 'filter' => $other->getName(),
274 'filterObject' => $other,
275 'globalDescription' => $globalDescription,
276 'contextDescription' => $contextDescription,
279 throw new MWException(
'You can only pass in a ChangesListFilterGroup or a ChangesListFilter' );
326 return isset( $this->filters[$name] ) ? $this->filters[
$name] :
null;
355 if ( isset( $this->whatsThisHeader ) ) {
369 usort( $this->filters,
function ( $a, $b ) {
370 return $b->getPriority() - $a->getPriority();
373 foreach ( $this->filters as $filterName => $filter ) {
374 if ( $filter->displaysOnStructuredUi() ) {
375 $filterData = $filter->getJsData();
376 $output[
'messageKeys'] = array_merge(
378 $filterData[
'messageKeys']
380 unset( $filterData[
'messageKeys'] );
381 $output[
'filters'][] = $filterData;
385 if ( count(
$output[
'filters'] ) === 0 ) {
391 $conflicts = array_merge(
392 $this->conflictingGroups,
393 $this->conflictingFilters
396 foreach ( $conflicts as $conflictInfo ) {
397 unset( $conflictInfo[
'filterObject'] );
398 unset( $conflictInfo[
'groupObject'] );
399 $output[
'conflicts'][] = $conflictInfo;
402 $conflictInfo[
'globalDescription'],
403 $conflictInfo[
'contextDescription']
417 function ( $conflictDesc ) {
418 return $conflictDesc[
'groupObject' ];
431 function ( $conflictDesc ) {
432 return $conflictDesc[
'filterObject' ];
445 return !!count( array_filter(
Represents a filter group (used on ChangesListSpecialPage and descendants)
$filters
Associative array of filters, as ChangesListFilter objects, with filter name as key.
$name
Name (internal identifier)
$whatsThisBody
i18n key for body of What's This?
anySelected(FormOptions $opts)
Check if any filter in this group is selected.
$whatsThisUrl
URL of What's This? link.
$isFullCoverage
Whether this group is full coverage.
isPerGroupRequestParameter()
Check whether the URL parameter is for the group, or for individual filters.
getFilter( $name)
Get filter by name.
$priority
Priority integer.
getConflictingGroups()
Get groups conflicting with this filter group.
$conflictingFilters
Array of associative arrays with conflict information.
getJsData()
Gets the JS data in the format required by the front-end of the structured UI.
__construct(array $groupDefinition)
Create a new filter group with the specified configuration.
$whatsThisHeader
i18n key for header of What's This?
getConflictingFilters()
Get filters conflicting with this filter group.
$conflictingGroups
Array of associative arrays with conflict information.
setUnidirectionalConflict( $other, $globalDescription, $contextDescription)
Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object.
createFilter(array $filterDefinition)
Creates a filter of the appropriate type for this group, from the definition.
$type
Type, from a TYPE constant of a subclass.
conflictsWith( $other, $globalKey, $forwardKey, $backwardKey)
Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object.
$whatsThisLinkText
i18n key for What's This? link
Represents a filter (used on ChangesListSpecialPage and descendants)
isSelected(FormOptions $opts)
Checks whether this filter is selected in the provided options.
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title after the basic globals have been set but before ordinary actions take place $output
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type