EditPage: Show a different label for the button on create vs. modify
authorJames D. Forrester <jforrester@wikimedia.org>
Thu, 30 Jun 2016 11:53:26 +0000 (12:53 +0100)
committerJames D. Forrester <jforrester@wikimedia.org>
Thu, 30 Jun 2016 12:01:05 +0000 (13:01 +0100)
This is exceedingly common in CMS software, and it was noted in the work
on T131132 that MediaWiki is unusual in not differentiating these cases.

Bug: T139033
Change-Id: Ie81b5edd275963a965cd44d0fd325cae9ee2f1a6

includes/EditPage.php

index 2a80ea6..7f94140 100644 (file)
@@ -4032,13 +4032,14 @@ HTML
        public function getEditButtons( &$tabindex ) {
                $buttons = [];
 
+               $buttonLabelKey = $this->isNew ? 'savearticle' : 'savechanges';
+               $buttonLabel = wfMessage( $buttonLabelKey )->text();
                $attribs = [
                        'id' => 'wpSave',
                        'name' => 'wpSave',
                        'tabindex' => ++$tabindex,
                ] + Linker::tooltipAndAccesskeyAttribs( 'save' );
-               $buttons['save'] = Html::submitButton( wfMessage( 'savearticle' )->text(),
-                       $attribs, [ 'mw-ui-constructive' ] );
+               $buttons['save'] = Html::submitButton( $buttonLabel, $attribs, [ 'mw-ui-constructive' ] );
 
                ++$tabindex; // use the same for preview and live preview
                $attribs = [