Florianschmidtwelzow has uploaded a new change for review. https://gerrit.wikimedia.org/r/311758
Change subject: HTMLForm: Implement OOUI version of HTMLTagFilter ...................................................................... HTMLForm: Implement OOUI version of HTMLTagFilter Also, introduce another way of handli, if the tag filter row in the form should be visible or not. Bug: T117739 Change-Id: Ia9990d1089773f61721cce731bb6cb767a174467 --- M includes/htmlform/fields/HTMLTagFilter.php 1 file changed, 27 insertions(+), 15 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/58/311758/1 diff --git a/includes/htmlform/fields/HTMLTagFilter.php b/includes/htmlform/fields/HTMLTagFilter.php index 8075de5..de17a68 100644 --- a/includes/htmlform/fields/HTMLTagFilter.php +++ b/includes/htmlform/fields/HTMLTagFilter.php @@ -5,27 +5,39 @@ class HTMLTagFilter extends HTMLFormField { protected $tagFilter; - function getTableRow( $value ) { - $this->tagFilter = ChangeTags::buildTagFilterSelector( $value ); - if ( $this->tagFilter ) { - return parent::getTableRow( $value ); - } - return ''; + public function hasVisibleOutput() { + return (bool) $this->getTagFilter(); } - function getDiv( $value ) { - $this->tagFilter = ChangeTags::buildTagFilterSelector( $value ); - if ( $this->tagFilter ) { - return parent::getDiv( $value ); + /** + * Returns the HTML of the tag filter, if there's one. If $v is null, the tag filter isn't + * cached for a second call, otherwise calling this function again will return the previously + * created tag filter (even if the second call's $value is different or null). + * + * @param null $v The pre-selected value + * @param bool $ooui See ChangeTags::buildTagFilterSelector() $ooui + * @return array + */ + protected function getTagFilter( $v = null, $ooui = false ) { + if ( $this->tagFilter !== null && $v === null ) { + return ChangeTags::buildTagFilterSelector(); + } else if ( $this->tagFilter === null ) { + $this->tagFilter = ChangeTags::buildTagFilterSelector( $v, false, null, $ooui ); } - return ''; + return $this->tagFilter; } - function getInputHTML( $value ) { - if ( $this->tagFilter ) { + public function getInputHTML( $value ) { + if ( $this->getTagFilter( $value, false ) ) { // we only need the select field, HTMLForm should handle the label - return $this->tagFilter[1]; + return $this->getTagFilter( $value )[1]; } - return ''; + } + + public function getInputOOUI( $value ) { + if ( $this->getTagFilter( $value, true ) ) { + // we only need the select field, HTMLForm should handle the label + return $this->getTagFilter( $value )[1]; + } } } -- To view, visit https://gerrit.wikimedia.org/r/311758 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia9990d1089773f61721cce731bb6cb767a174467 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits