MediaWiki master
HTMLTagFilter.php
Go to the documentation of this file.
1<?php
2
4
7
15 protected $tagFilter;
16
18 protected $activeOnly = ChangeTags::TAG_SET_ACTIVE_ONLY;
19
21 protected $useAllTags = ChangeTags::USE_ALL_TAGS;
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
42 public function getTableRow( $value ) {
43 $this->tagFilter = ChangeTags::buildTagFilterSelector(
44 $value,
45 false,
46 $this->mParent->getContext(),
47 $this->activeOnly,
48 $this->useAllTags
49 );
50 if ( $this->tagFilter ) {
51 return parent::getTableRow( $value );
52 }
53 return '';
54 }
55
57 public function getDiv( $value ) {
58 $this->tagFilter = ChangeTags::buildTagFilterSelector(
59 $value,
60 false,
61 $this->mParent->getContext(),
62 $this->activeOnly,
63 $this->useAllTags
64 );
65 if ( $this->tagFilter ) {
66 return parent::getDiv( $value );
67 }
68 return '';
69 }
70
72 public function getOOUI( $value ) {
73 $this->tagFilter = ChangeTags::buildTagFilterSelector(
74 $value,
75 true,
76 $this->mParent->getContext(),
77 $this->activeOnly,
78 $this->useAllTags
79 );
80 if ( $this->tagFilter ) {
81 return parent::getOOUI( $value );
82 }
83 return new \OOUI\FieldLayout( new \OOUI\Widget() );
84 }
85
87 public function getInputHTML( $value ) {
88 if ( $this->tagFilter ) {
89 // we only need the select field, HTMLForm should handle the label
90 return $this->tagFilter[1];
91 }
92 return '';
93 }
94
96 public function getInputOOUI( $value ) {
97 if ( $this->tagFilter ) {
98 // we only need the select field, HTMLForm should handle the label
99 return $this->tagFilter[1];
100 }
101 return '';
102 }
103
105 protected function shouldInfuseOOUI() {
106 return true;
107 }
108}
109
111class_alias( HTMLTagFilter::class, 'HTMLTagFilter' );
Recent changes tagging.
Wrapper for ChangeTags::buildTagFilterSelector to use in HTMLForm.
getOOUI( $value)
Get the OOUI version of the div.Falls back to getDiv by default. to override 1.26\OOUI\FieldLayout
getDiv( $value)
Get the complete div for the input, including help text, labels, and whatever.to override 1....
getInputOOUI( $value)
Same as getInputHTML, but returns an OOUI object.Defaults to false, which getOOUI will interpret as "...
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.Note that all OOUI HTMLForm fields are infusable (y...
The parent class to generate form fields.