function getButtons() {
$buttons = '';
+ // IE<8 has bugs with <button>, so we'll need to avoid them.
+ $isBadIE = preg_match( '/MSIE [1-7]\./i', $this->getRequest()->getHeader( 'User-Agent' ) );
+
if ( $this->mShowSubmit ) {
$attribs = array( 'infusable' => true );
$attribs['label'] = $this->getSubmitText();
$attribs['value'] = $this->getSubmitText();
$attribs['flags'] = $this->mSubmitFlags;
+ $attribs['useInputTag'] = $isBadIE;
$buttons .= new OOUI\ButtonInputWidget( $attribs );
}
$buttons .= new OOUI\ButtonInputWidget( array(
'type' => 'reset',
'label' => $this->msg( 'htmlform-reset' )->text(),
+ 'useInputTag' => $isBadIE,
) );
}
$attrs['id'] = $button['id'];
}
+ if ( $isBadIE ) {
+ $label = $button['value'];
+ } elseif ( isset( $button['label-message'] ) ) {
+ $label = new OOUI\HtmlSnippet( $this->msg( $button['label-message'] )->parse() );
+ } elseif ( isset( $button['label'] ) ) {
+ $label = $button['label'];
+ } elseif ( isset( $button['label-raw'] ) ) {
+ $label = new OOUI\HtmlSnippet( $button['label-raw'] );
+ } else {
+ $label = $button['value'];
+ }
+
$attrs['classes'] = isset( $attrs['class'] ) ? (array)$attrs['class'] : array();
$buttons .= new OOUI\ButtonInputWidget( array(
'type' => 'submit',
'name' => $button['name'],
'value' => $button['value'],
- 'label' => $button['value'],
+ 'label' => $label,
+ 'flags' => $button['flags'],
+ 'useInputTag' => $isBadIE,
) + $attrs );
}
return $html;
}
+ protected function wrapFieldSetSection( $legend, $section, $attributes ) {
+ // to get a user visible effect, wrap the fieldset into a framed panel layout
+ $layout = new OOUI\PanelLayout( array(
+ 'expanded' => false,
+ 'padded' => true,
+ 'framed' => true,
+ 'infusable' => false,
+ ) );
+
+ $layout->appendContent(
+ new OOUI\FieldsetLayout( array(
+ 'label' => $legend,
+ 'infusable' => false,
+ 'items' => array(
+ new OOUI\Widget( array(
+ 'content' => new OOUI\HtmlSnippet( $section )
+ ) ),
+ ),
+ ) + $attributes )
+ );
+ return $layout;
+ }
+
/**
* Put a form section together from the individual fields' HTML, merging it and wrapping.
- * @param OOUI\\FieldLayout[] $fieldsHtml
+ * @param OOUI\FieldLayout[] $fieldsHtml
* @param string $sectionName
* @param bool $anyFieldHasLabel Unused
* @return string HTML
$msg = $error;
$error = array();
}
- $error = $this->msg( $msg, $error )->parse();
+ // if the error is already a message object, don't use it as a message key
+ if ( !$msg instanceof Message ) {
+ $error = $this->msg( $msg, $error )->parse();
+ } else {
+ $error = $msg->parse();
+ }
$error = new OOUI\HtmlSnippet( $error );
}