// Note: the maxlength is overridden in JS to 255 and to make it use UTF-8 bytes, not characters.
return ( is_array( $inputAttrs ) ? $inputAttrs : [] ) + [
'id' => 'wpSummary',
+ 'name' => 'wpSummary',
'maxlength' => '200',
'tabindex' => '1',
'size' => 60,
return $checkboxes;
}
+ /**
+ * Get the message key of the label for the button to save the page
+ *
+ * @return string
+ */
+ private function getSaveButtonLabel() {
+ $labelAsPublish =
+ $this->mArticle->getContext()->getConfig()->get( 'EditSubmitButtonLabelPublish' );
+
+ // Can't use $this->isNew as that's also true if we're adding a new section to an extant page
+ $newPage = !$this->mTitle->exists();
+
+ if ( $labelAsPublish ) {
+ $buttonLabelKey = $newPage ? 'publishpage' : 'publishchanges';
+ } else {
+ $buttonLabelKey = $newPage ? 'savearticle' : 'savechanges';
+ }
+
+ return $buttonLabelKey;
+ }
+
/**
* Returns an array of html code of the following buttons:
* save, diff and preview
public function getEditButtons( &$tabindex ) {
$buttons = [];
- $labelAsPublish =
- $this->mArticle->getContext()->getConfig()->get( 'EditSubmitButtonLabelPublish' );
+ $buttonLabelKey = $this->getSaveButtonLabel();
- // Can't use $this->isNew as that's also true if we're adding a new section to an extant page
- if ( $labelAsPublish ) {
- $buttonLabelKey = !$this->mTitle->exists() ? 'publishpage' : 'publishchanges';
- } else {
- $buttonLabelKey = !$this->mTitle->exists() ? 'savearticle' : 'savechanges';
- }
$attribs = [
'id' => 'wpSave',
'name' => 'wpSave',
if ( $this->oouiEnabled ) {
$saveConfig = OOUI\Element::configFromHtmlAttributes( $attribs );
$buttons['save'] = new OOUI\ButtonInputWidget( [
+ // Support: IE 6 – Use <input>, otherwise it can't distinguish which button was clicked
+ 'useInputTag' => true,
'flags' => [ 'constructive', 'primary' ],
'label' => $this->context->msg( $buttonLabelKey )->text(),
'infusable' => true,
if ( $this->oouiEnabled ) {
$previewConfig = OOUI\Element::configFromHtmlAttributes( $attribs );
$buttons['preview'] = new OOUI\ButtonInputWidget( [
+ // Support: IE 6 – Use <input>, otherwise it can't distinguish which button was clicked
+ 'useInputTag' => true,
'label' => $this->context->msg( 'showpreview' )->text(),
'infusable' => true,
'type' => 'submit'
if ( $this->oouiEnabled ) {
$diffConfig = OOUI\Element::configFromHtmlAttributes( $attribs );
$buttons['diff'] = new OOUI\ButtonInputWidget( [
+ // Support: IE 6 – Use <input>, otherwise it can't distinguish which button was clicked
+ 'useInputTag' => true,
'label' => $this->context->msg( 'showdiff' )->text(),
'infusable' => true,
'type' => 'submit',