summaryrefslogtreecommitdiff
path: root/www/wiki/includes/htmlform/fields/HTMLTagFilter.php
blob: 38f9a0a100ab4a67f111ee1631cc56a847c60f34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
 * Wrapper for ChangeTags::buildTagFilterSelector to use in HTMLForm
 */
class HTMLTagFilter extends HTMLFormField {
	protected $tagFilter;

	public function getTableRow( $value ) {
		$this->tagFilter = ChangeTags::buildTagFilterSelector(
			$value, false, $this->mParent->getContext() );
		if ( $this->tagFilter ) {
			return parent::getTableRow( $value );
		}
		return '';
	}

	public function getDiv( $value ) {
		$this->tagFilter = ChangeTags::buildTagFilterSelector(
			$value, false, $this->mParent->getContext() );
		if ( $this->tagFilter ) {
			return parent::getDiv( $value );
		}
		return '';
	}

	public function getOOUI( $value ) {
		$this->tagFilter = ChangeTags::buildTagFilterSelector(
			$value, true, $this->mParent->getContext() );
		if ( $this->tagFilter ) {
			return parent::getOOUI( $value );
		}
		return new OOUI\FieldLayout( new OOUI\Widget() );
	}

	public function getInputHTML( $value ) {
		if ( $this->tagFilter ) {
			// we only need the select field, HTMLForm should handle the label
			return $this->tagFilter[1];
		}
		return '';
	}

	public function getInputOOUI( $value ) {
		if ( $this->tagFilter ) {
			// we only need the select field, HTMLForm should handle the label
			return $this->tagFilter[1];
		}
		return '';
	}
}