Go to the documentation of this file.
138 if ( isset( $filterDefinition[
'group'] ) ) {
139 $this->
group = $filterDefinition[
'group'];
141 throw new MWException(
'You must use \'group\' to specify the ' .
142 'ChangesListFilterGroup this filter belongs to' );
145 if ( strpos( $filterDefinition[
'name'], self::RESERVED_NAME_CHAR ) !==
false ) {
146 throw new MWException(
'Filter names may not contain \'' .
147 self::RESERVED_NAME_CHAR .
148 '\'. Use the naming convention: \
'lowercase\''
152 if ( $this->
group->getFilter( $filterDefinition[
'name'] ) ) {
153 throw new MWException(
'Two filters in a group cannot have the ' .
154 "same name: '{$filterDefinition['name']}'" );
157 $this->
name = $filterDefinition[
'name'];
159 if ( isset( $filterDefinition[
'cssClassSuffix'] ) ) {
160 $this->cssClassSuffix = $filterDefinition[
'cssClassSuffix'];
161 $this->isRowApplicableCallable = $filterDefinition[
'isRowApplicableCallable'];
164 if ( isset( $filterDefinition[
'label'] ) ) {
165 $this->label = $filterDefinition[
'label'];
166 $this->description = $filterDefinition[
'description'];
169 $this->priority = $filterDefinition[
'priority'];
171 $this->
group->registerFilter( $this );
189 public function conflictsWith( $other, $globalKey, $forwardKey, $backwardKey ) {
190 if ( $globalKey ===
null || $forwardKey ===
null || $backwardKey ===
null ) {
191 throw new MWException(
'All messages must be specified' );
200 $other->setUnidirectionalConflict(
221 $this->conflictingGroups[] = [
222 'group' => $other->getName(),
223 'groupObject' => $other,
224 'globalDescription' => $globalDescription,
225 'contextDescription' => $contextDescription,
228 $this->conflictingFilters[] = [
229 'group' => $other->getGroup()->getName(),
230 'filter' => $other->getName(),
231 'filterObject' => $other,
232 'globalDescription' => $globalDescription,
233 'contextDescription' => $contextDescription,
236 throw new MWException(
'You can only pass in a ChangesListFilterGroup or a ChangesListFilter' );
251 throw new MWException(
'Supersets can only be defined for filters in the same group' );
254 $this->subsetFilters[] = [
257 'group' => $other->
getGroup()->getName(),
304 return $this->label !==
null;
331 if ( $this->cssClassSuffix !==
null ) {
346 if ( $this->isRowApplicableCallable ===
null ) {
350 if ( call_user_func( $this->isRowApplicableCallable, $ctx, $rc ) ) {
378 $conflicts = array_merge(
379 $this->conflictingGroups,
380 $this->conflictingFilters
383 foreach ( $conflicts
as $conflictInfo ) {
384 unset( $conflictInfo[
'filterObject'] );
385 unset( $conflictInfo[
'groupObject'] );
386 $output[
'conflicts'][] = $conflictInfo;
389 $conflictInfo[
'globalDescription'],
390 $conflictInfo[
'contextDescription']
412 function ( $conflictDesc ) {
413 return $conflictDesc[
'groupObject' ];
426 function ( $conflictDesc ) {
427 return $conflictDesc[
'filterObject' ];
444 if ( $siblingFilter->isSelected( $opts ) && !$siblingFilter->hasConflictWithGroup(
$group ) ) {
465 if ( $this->
isSelected( $opts ) && $filter->isSelected( $opts ) ) {
469 $siblingFilter->isSelected( $opts ) &&
470 !$siblingFilter->hasConflictWithFilter( $filter )
492 function ( $filter ) {
493 return $filter !== $this;
activelyInConflictWithGroup(ChangesListFilterGroup $group, FormOptions $opts)
Check if the conflict with a group is currently "active".
isSelected(FormOptions $opts)
Checks whether this filter is selected in the provided options.
hasConflictWithFilter(ChangeslistFilter $filter)
$subsetFilters
Array of associative arrays with subset information.
Utility class for creating new RC entries.
displaysOnUnstructuredUi()
Checks whether the filter should display on the unstructured UI.
setAsSupersetOf(ChangesListFilter $other)
Marks that the current instance is (also) a superset of the filter passed in.
$priority
Priority integer.
displaysOnStructuredUi()
Checks whether the filter should display on the structured UI This refers to the exact filter.
activelyInConflictWithFilter(ChangeslistFilter $filter, FormOptions $opts)
Check if the conflict with a filter is currently "active".
$isRowApplicableCallable
Callable that returns true if and only if a row is attributed to this filter.
Represents a filter group (used on ChangesListSpecialPage and descendants)
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
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
$cssClassSuffix
CSS class suffix used for attribution, e.g.
conflictsWith( $other, $globalKey, $forwardKey, $backwardKey)
Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object.
hasConflictWithGroup(ChangesListFilterGroup $group)
$label
i18n key of label for structured UI
getSiblings()
Get filters in the same group.
getConflictingGroups()
Get groups conflicting with this filter.
getJsData()
Gets the JS data required by the front-end of the structured UI.
applyCssClassIfNeeded(IContextSource $ctx, RecentChange $rc, array &$classes)
Add CSS class if needed.
isFeatureAvailableOnStructuredUi()
Checks whether an equivalent feature for this filter is available on the structured UI.
getCssClass()
Gets the CSS class.
Interface for objects which can provide a MediaWiki context on request.
$conflictingGroups
Array of associative arrays with conflict information.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
setUnidirectionalConflict( $other, $globalDescription, $contextDescription)
Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object.
Represents a filter (used on ChangesListSpecialPage and descendants)
$description
i18n key of description for structured UI
$conflictingFilters
Array of associative arrays with conflict information.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at name
__construct(array $filterDefinition)
Creates a new filter with the specified configuration, and registers it to the specified group.
no text was provided for refs named< code > blankwithnoreference</code ></span ></li ></ol ></div > ! end ! test with< references/> in group ! wikitext Wikipedia rocks< ref > Proceeds of vol XXI</ref > Wikipedia rocks< ref group=note > Proceeds of vol XXI</ref >< references/>< references group=note/> ! html< p > Wikipedia rocks< sup id="cite_ref-1" class="reference">< a href="#cite_note-1"> &Wikipedia rocks< sup id="cite_ref-2" class="reference">< a href="#cite_note-2"> &</p >< div class="mw-references-wrap">< ol class="references">< li id="cite_note-1">< span class="mw-cite-backlink">< a href="#cite_ref-1"> ↑</a ></span >< span class="reference-text"> Proceeds of vol XXI</span ></li ></ol ></div >< div class="mw-references-wrap">< ol class="references">< li id="cite_note-2">< span class="mw-cite-backlink">< a href="#cite_ref-2"> ↑</a ></span >< span class="reference-text"> Proceeds of vol XXI</span ></li ></ol ></div > ! end ! test with< references/> in group
getConflictingFilters()
Get filters conflicting with this filter.
the array() calling protocol came about after MediaWiki 1.4rc1.