MediaWiki  master
HTMLTagFilter.php
Go to the documentation of this file.
1 <?php
7 class HTMLTagFilter extends HTMLFormField {
8  protected $tagFilter;
9 
10  public function getTableRow( $value ) {
11  $this->tagFilter = ChangeTags::buildTagFilterSelector(
12  $value, false, $this->mParent->getContext() );
13  if ( $this->tagFilter ) {
14  return parent::getTableRow( $value );
15  }
16  return '';
17  }
18 
19  public function getDiv( $value ) {
20  $this->tagFilter = ChangeTags::buildTagFilterSelector(
21  $value, false, $this->mParent->getContext() );
22  if ( $this->tagFilter ) {
23  return parent::getDiv( $value );
24  }
25  return '';
26  }
27 
28  public function getOOUI( $value ) {
29  $this->tagFilter = ChangeTags::buildTagFilterSelector(
30  $value, true, $this->mParent->getContext() );
31  if ( $this->tagFilter ) {
32  return parent::getOOUI( $value );
33  }
34  return new OOUI\FieldLayout( new OOUI\Widget() );
35  }
36 
37  public function getInputHTML( $value ) {
38  if ( $this->tagFilter ) {
39  // we only need the select field, HTMLForm should handle the label
40  return $this->tagFilter[1];
41  }
42  return '';
43  }
44 
45  public function getInputOOUI( $value ) {
46  if ( $this->tagFilter ) {
47  // we only need the select field, HTMLForm should handle the label
48  return $this->tagFilter[1];
49  }
50  return '';
51  }
52 
53  protected function shouldInfuseOOUI() {
54  return true;
55  }
56 }
static buildTagFilterSelector( $selected='', $ooui=false, IContextSource $context=null)
Build a text box to select a change tag.
Definition: ChangeTags.php:987
The parent class to generate form fields.
Wrapper for ChangeTags::buildTagFilterSelector to use in HTMLForm.
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.
getOOUI( $value)
Get the OOUI version of the div.
shouldInfuseOOUI()
Whether the field should be automatically infused.
getInputOOUI( $value)
Same as getInputHTML, but returns an OOUI object.
getDiv( $value)
Get the complete div for the input, including help text, labels, and whatever.