Merge "Show a warning in edit preview when a template loop is detected"
[lhc/web/wiklou.git] / includes / changes / ChangesListBooleanFilterGroup.php
1 <?php
2
3 /**
4 * If the group is active, any unchecked filters will
5 * translate to hide parameters in the URL. E.g. if 'Human (not bot)' is checked,
6 * but 'Bot' is unchecked, hidebots=1 will be sent.
7 *
8 * @since 1.29
9 */
10 class ChangesListBooleanFilterGroup extends ChangesListFilterGroup {
11 /**
12 * Type marker, used by JavaScript
13 */
14 const TYPE = 'send_unselected_if_any';
15
16 /**
17 * Create a new filter group with the specified configuration
18 *
19 * @param array $groupDefinition Configuration of group
20 * * $groupDefinition['name'] string Group name
21 * * $groupDefinition['title'] string i18n key for title (optional, can be omitted
22 * only if none of the filters in the group display in the structured UI)
23 * * $groupDefinition['priority'] int Priority integer. Higher means higher in the
24 * group list.
25 * * $groupDefinition['filters'] array Numeric array of filter definitions, each of which
26 * is an associative array to be passed to the filter constructor. However,
27 * 'priority' is optional for the filters. Any filter that has priority unset
28 * will be put to the bottom, in the order given.
29 * * $groupDefinition['whatsThisHeader'] string i18n key for header of "What's
30 * This" popup (optional).
31 * * $groupDefinition['whatsThisBody'] string i18n key for body of "What's This"
32 * popup (optional).
33 * * $groupDefinition['whatsThisUrl'] string URL for main link of "What's This"
34 * popup (optional).
35 * * $groupDefinition['whatsThisLinkText'] string i18n key of text for main link of
36 * "What's This" popup (optional).
37 */
38 public function __construct( array $groupDefinition ) {
39 $groupDefinition['isFullCoverage'] = true;
40 $groupDefinition['type'] = self::TYPE;
41
42 parent::__construct( $groupDefinition );
43 }
44
45 /**
46 * @inheritDoc
47 */
48 protected function createFilter( array $filterDefinition ) {
49 return new ChangesListBooleanFilter( $filterDefinition );
50 }
51
52 /**
53 * Registers a filter in this group
54 *
55 * @param ChangesListBooleanFilter $filter ChangesListBooleanFilter
56 */
57 public function registerFilter( ChangesListBooleanFilter $filter ) {
58 $this->filters[$filter->getName()] = $filter;
59 }
60
61 /**
62 * @inheritDoc
63 */
64 public function isPerGroupRequestParameter() {
65 return false;
66 }
67 }