MediaWiki master
HTMLTagFilter.php
Go to the documentation of this file.
1<?php
2
4
5use ChangeTags;
7
15 protected $tagFilter;
16
19
22
30 public function __construct( $params ) {
31 parent::__construct( $params );
32
33 if ( array_key_exists( 'activeOnly', $params ) ) {
34 $this->activeOnly = $params['activeOnly'];
35 }
36 if ( array_key_exists( 'useAllTags', $params ) ) {
37 $this->useAllTags = $params['useAllTags'];
38 }
39 }
40
41 public function getTableRow( $value ) {
42 $this->tagFilter = ChangeTags::buildTagFilterSelector(
43 $value,
44 false,
45 $this->mParent->getContext(),
46 $this->activeOnly,
47 $this->useAllTags
48 );
49 if ( $this->tagFilter ) {
50 return parent::getTableRow( $value );
51 }
52 return '';
53 }
54
55 public function getDiv( $value ) {
56 $this->tagFilter = ChangeTags::buildTagFilterSelector(
57 $value,
58 false,
59 $this->mParent->getContext(),
60 $this->activeOnly,
61 $this->useAllTags
62 );
63 if ( $this->tagFilter ) {
64 return parent::getDiv( $value );
65 }
66 return '';
67 }
68
69 public function getOOUI( $value ) {
70 $this->tagFilter = ChangeTags::buildTagFilterSelector(
71 $value,
72 true,
73 $this->mParent->getContext(),
74 $this->activeOnly,
75 $this->useAllTags
76 );
77 if ( $this->tagFilter ) {
78 return parent::getOOUI( $value );
79 }
80 return new \OOUI\FieldLayout( new \OOUI\Widget() );
81 }
82
83 public function getInputHTML( $value ) {
84 if ( $this->tagFilter ) {
85 // we only need the select field, HTMLForm should handle the label
86 return $this->tagFilter[1];
87 }
88 return '';
89 }
90
91 public function getInputOOUI( $value ) {
92 if ( $this->tagFilter ) {
93 // we only need the select field, HTMLForm should handle the label
94 return $this->tagFilter[1];
95 }
96 return '';
97 }
98
99 protected function shouldInfuseOOUI() {
100 return true;
101 }
102}
103
105class_alias( HTMLTagFilter::class, 'HTMLTagFilter' );
array $params
The job parameters.
Recent changes tagging.
const USE_ALL_TAGS
Constants that can be used to set the useAllTags parameter for calling self::buildCustomTagFilterSele...
static buildTagFilterSelector( $selected='', $ooui=false, ?IContextSource $context=null, bool $activeOnly=self::TAG_SET_ACTIVE_ONLY, bool $useAllTags=self::USE_ALL_TAGS)
Build a text box to select a change tag.
const TAG_SET_ACTIVE_ONLY
Constants that can be used to set the activeOnly parameter for calling self::buildCustomTagFilterSele...
Wrapper for ChangeTags::buildTagFilterSelector to use in HTMLForm.
getOOUI( $value)
Get the OOUI version of the div.
getDiv( $value)
Get the complete div for the input, including help text, labels, and whatever.
getInputOOUI( $value)
Same as getInputHTML, but returns an OOUI object.
getInputHTML( $value)
This function must be implemented to return the HTML to generate the input object itself.
getTableRow( $value)
Get the complete table row for the input, including help text, labels, and whatever.
__construct( $params)
Initialise the object.to call 1.22 The 'label' attribute no longer accepts raw HTML,...
shouldInfuseOOUI()
Whether the field should be automatically infused.
The parent class to generate form fields.