MediaWiki master
HTMLTagFilter.php
Go to the documentation of this file.
1<?php
2
4
5use ChangeTags;
7
14 protected $tagFilter;
15
16 public function getTableRow( $value ) {
17 $this->tagFilter = ChangeTags::buildTagFilterSelector(
18 $value, false, $this->mParent->getContext() );
19 if ( $this->tagFilter ) {
20 return parent::getTableRow( $value );
21 }
22 return '';
23 }
24
25 public function getDiv( $value ) {
26 $this->tagFilter = ChangeTags::buildTagFilterSelector(
27 $value, false, $this->mParent->getContext() );
28 if ( $this->tagFilter ) {
29 return parent::getDiv( $value );
30 }
31 return '';
32 }
33
34 public function getOOUI( $value ) {
35 $this->tagFilter = ChangeTags::buildTagFilterSelector(
36 $value, true, $this->mParent->getContext() );
37 if ( $this->tagFilter ) {
38 return parent::getOOUI( $value );
39 }
40 return new \OOUI\FieldLayout( new \OOUI\Widget() );
41 }
42
43 public function getInputHTML( $value ) {
44 if ( $this->tagFilter ) {
45 // we only need the select field, HTMLForm should handle the label
46 return $this->tagFilter[1];
47 }
48 return '';
49 }
50
51 public function getInputOOUI( $value ) {
52 if ( $this->tagFilter ) {
53 // we only need the select field, HTMLForm should handle the label
54 return $this->tagFilter[1];
55 }
56 return '';
57 }
58
59 protected function shouldInfuseOOUI() {
60 return true;
61 }
62}
63
65class_alias( HTMLTagFilter::class, 'HTMLTagFilter' );
static buildTagFilterSelector( $selected='', $ooui=false, IContextSource $context=null)
Build a text box to select a change tag.
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.
shouldInfuseOOUI()
Whether the field should be automatically infused.
The parent class to generate form fields.