$rows = $this->mParams['rows'];
$columns = $this->mParams['columns'];
- $attribs = $this->getAttributes( array( 'disabled', 'tabindex' ) );
+ $mappings = array();
+
+ if ( $this->mParent instanceof OOUIHTMLForm ) {
+ $mappings['tabindex'] = 'tabIndex';
+ }
+
+ $attribs = $this->getAttributes( array( 'disabled', 'tabindex' ), $mappings );
// Build the column headers
$headerContents = Html::rawElement( 'td', array(), ' ' );
$checked = true;
$thisAttribs['disabled'] = 1;
}
- $chkBox = Xml::check( "{$this->mName}[]", $checked, $attribs + $thisAttribs );
+ $chkBox = $this->getOneCheckbox( $checked, $attribs + $thisAttribs );
+
if ( $this->mParent->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
$chkBox = Html::openElement( 'div', array( 'class' => 'mw-ui-checkbox' ) ) .
$chkBox .
return $html;
}
+ protected function getOneCheckbox( $checked, $attribs ) {
+ if ( $this->mParent instanceof OOUIHTMLForm ) {
+ return new OOUI\CheckboxInputWidget( array(
+ 'name' => "{$this->mName}[]",
+ 'selected' => $checked,
+ 'value' => '1',
+ ) + $attribs );
+ }
+
+ return Xml::check( "{$this->mName}[]", $checked, $attribs );
+ }
+
protected function isTagForcedOff( $tag ) {
return isset( $this->mParams['force-options-off'] )
&& in_array( $tag, $this->mParams['force-options-off'] );
$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(
$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;