Merge "Add support for PHP7 random_bytes in favor of mcrypt_create_iv"
[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 */
30 public function __construct( array $groupDefinition ) {
31 $groupDefinition['isFullCoverage'] = true;
32 $groupDefinition['type'] = self::TYPE;
33
34 parent::__construct( $groupDefinition );
35 }
36
37 /**
38 * @inheritdoc
39 */
40 protected function createFilter( array $filterDefinition ) {
41 return new ChangesListBooleanFilter( $filterDefinition );
42 }
43
44 /**
45 * Registers a filter in this group
46 *
47 * @param ChangesListBooleanFilter $filter ChangesListBooleanFilter
48 */
49 public function registerFilter( ChangesListBooleanFilter $filter ) {
50 $this->filters[$filter->getName()] = $filter;
51 }
52
53 /**
54 * @inheritdoc
55 */
56 public function isPerGroupRequestParameter() {
57 return false;
58 }
59 }