EditPage: Rename and make getSubmitButtonLabel() protected
authorKunal Mehta <legoktm@member.fsf.org>
Tue, 12 Sep 2017 18:17:20 +0000 (11:17 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Tue, 12 Sep 2017 18:19:57 +0000 (11:19 -0700)
Calling this method "SaveButton" is misleading since this function
controls whether the button is called "save" or "publish". The
corresponding config option (EditSubmitButtonLabelPublish) already uses
the terminology "SubmitButton" so re-use it here.

And make it protected so subclasses (e.g. TwoColConflict) can use it
instead of having to re-implement it.

Change-Id: Iae811f0487f661bb501a9893037c352efa4e1e73

includes/EditPage.php

index 06a5cc3..615bf77 100644 (file)
@@ -2915,7 +2915,7 @@ class EditPage {
                                }
                        }
 
-                       $buttonLabel = $this->context->msg( $this->getSaveButtonLabel() )->text();
+                       $buttonLabel = $this->context->msg( $this->getSubmitButtonLabel() )->text();
 
                        if ( $this->missingComment ) {
                                $out->wrapWikiMsg( "<div id='mw-missingcommenttext'>\n$1\n</div>", 'missingcommenttext' );
@@ -4333,9 +4333,9 @@ class EditPage {
         *
         * @return string
         */
-       private function getSaveButtonLabel() {
+       protected function getSubmitButtonLabel() {
                $labelAsPublish =
-                       $this->mArticle->getContext()->getConfig()->get( 'EditSubmitButtonLabelPublish' );
+                       $this->context->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();
@@ -4360,7 +4360,7 @@ class EditPage {
        public function getEditButtons( &$tabindex ) {
                $buttons = [];
 
-               $buttonLabel = $this->context->msg( $this->getSaveButtonLabel() )->text();
+               $buttonLabel = $this->context->msg( $this->getSubmitButtonLabel() )->text();
 
                $attribs = [
                        'name' => 'wpSave',
@@ -4717,7 +4717,7 @@ class EditPage {
        protected function addExplainConflictHeader( OutputPage $out ) {
                $out->wrapWikiMsg(
                        "<div class='mw-explainconflict'>\n$1\n</div>",
-                       [ 'explainconflict', $this->context->msg( $this->getSaveButtonLabel() )->text() ]
+                       [ 'explainconflict', $this->context->msg( $this->getSubmitButtonLabel() )->text() ]
                );
        }