jenkins-bot has submitted this change and it was merged.

Change subject: HTMLForm: Support hide-if for HTMLCheckMatrix
......................................................................


HTMLForm: Support hide-if for HTMLCheckMatrix

It outputs multiple table rows, and each one needs the class and data
attribute.

Change-Id: I6667c3ea0e10167d941cb214d76889b389af79a3
---
M includes/htmlform/HTMLCheckMatrix.php
1 file changed, 12 insertions(+), 2 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/htmlform/HTMLCheckMatrix.php 
b/includes/htmlform/HTMLCheckMatrix.php
index 6c538fd..83f1266 100644
--- a/includes/htmlform/HTMLCheckMatrix.php
+++ b/includes/htmlform/HTMLCheckMatrix.php
@@ -178,6 +178,13 @@
                $helptext = $this->getHelpTextHtmlTable( $this->getHelpText() );
                $cellAttributes = array( 'colspan' => 2 );
 
+               $hideClass = '';
+               $hideAttributes = array();
+               if ( $this->mHideIf ) {
+                       $hideAttributes['data-hide-if'] = FormatJson::encode( 
$this->mHideIf );
+                       $hideClass = 'mw-htmlform-hide-if';
+               }
+
                $label = $this->getLabelHtml( $cellAttributes );
 
                $field = Html::rawElement(
@@ -186,9 +193,12 @@
                        $inputHtml . "\n$errors"
                );
 
-               $html = Html::rawElement( 'tr', array( 'class' => 
'mw-htmlform-vertical-label' ), $label );
+               $html = Html::rawElement( 'tr',
+                       array( 'class' => "mw-htmlform-vertical-label 
$hideClass" ) + $hideAttributes,
+                       $label );
                $html .= Html::rawElement( 'tr',
-                       array( 'class' => "mw-htmlform-field-$fieldType 
{$this->mClass} $errorClass" ),
+                       array( 'class' => "mw-htmlform-field-$fieldType 
{$this->mClass} $errorClass $hideClass" ) +
+                               $hideAttributes,
                        $field );
 
                return $html . $helptext;

-- 
To view, visit https://gerrit.wikimedia.org/r/189199
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6667c3ea0e10167d941cb214d76889b389af79a3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: CSteipp <[email protected]>
Gerrit-Reviewer: Daniel Friesen <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to