41 const TYPE =
'string_options';
112 if ( !isset( $groupDefinition[
'isFullCoverage'] ) ) {
113 throw new MWException(
'You must specify isFullCoverage' );
118 parent::__construct( $groupDefinition );
120 $this->queryCallable = $groupDefinition[
'queryCallable'];
122 if ( isset( $groupDefinition[
'default'] ) ) {
123 $this->
setDefault( $groupDefinition[
'default'] );
125 throw new MWException(
'You must specify a default' );
160 $this->filters[$filter->
getName()] = $filter;
167 &
$tables, &$fields, &$conds, &$query_options, &$join_conds,
170 if ( !$this->
isActive( $isStructuredFiltersEnabled ) ) {
175 $allowedFilterNames = [];
176 foreach ( $this->filters as $filter ) {
177 $allowedFilterNames[] = $filter->getName();
180 if (
$value === self::ALL ) {
181 $selectedValues = $allowedFilterNames;
183 $selectedValues = explode( self::SEPARATOR, strtolower(
$value ) );
186 $selectedValues = array_intersect(
197 if ( count( $selectedValues ) === 0 ) {
201 sort( $selectedValues );
203 call_user_func_array(
204 $this->queryCallable,
206 get_class( $specialPage ),
246 return $isStructuredUI;
Represents a filter group (used on ChangesListSpecialPage and descendants)
Special page which uses a ChangesList to show query results.
Represents a filter group with multiple string options.
addOptions(FormOptions $opts, $allowDefaults, $isStructuredFiltersEnabled)
@inheritDoc
getDefault()
Gets default of filter group.
__construct(array $groupDefinition)
Create a new filter group with the specified configuration.
$defaultValue
Defaul parameter value.
registerFilter(ChangesListStringOptionsFilter $filter)
Registers a filter in this group.
const ALL
Signifies that all options in the group are selected.
const TYPE
Type marker, used by JavaScript.
$queryCallable
Callable used to do the actual query modification; see constructor.
const SEPARATOR
Delimiter.
createFilter(array $filterDefinition)
@inheritDoc
setDefault( $defaultValue)
Sets default of filter group.
isActive( $isStructuredUI)
Check if this filter group is currently active.
modifyQuery(IDatabase $dbr, ChangesListSpecialPage $specialPage, &$tables, &$fields, &$conds, &$query_options, &$join_conds, FormOptions $opts, $isStructuredFiltersEnabled)
@inheritDoc
const NONE
Signifies that no options in the group are selected, meaning the group has no effect.
An individual filter in a ChangesListStringOptionsFilterGroup.
getContext()
Gets the context this SpecialPage is executed in.
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 hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables