From d7da3e44528b9ba16391e101c841da17c1a3fed9 Mon Sep 17 00:00:00 2001 From: Jforrester Date: Wed, 24 Aug 2016 23:19:36 +0000 Subject: [PATCH] EditPage: Don't show create label for the button on new sections It turns out that the helpful $this->isNew is true on new section edits, whether or not the page exists, so instead we have to fall back on the $this->mTitle->exists() call that partially populates isNew anyway. Change-Id: I7d7cdecda51c6ab4b05496f0b1420cb0264fcccb --- includes/EditPage.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 738eaecdf8..0da7e6e9ef 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -4070,10 +4070,11 @@ HTML $buttons = []; $labelAsPublish = $this->mArticle->getContext()->getConfig()->get( 'EditButtonPublishNotSave' ); + // 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->isNew ? 'publishpage' : 'publishchanges'; + $buttonLabelKey = !$this->mTitle->exists() ? 'publishpage' : 'publishchanges'; } else { - $buttonLabelKey = $this->isNew ? 'savearticle' : 'savechanges'; + $buttonLabelKey = !$this->mTitle->exists() ? 'savearticle' : 'savechanges'; } $buttonLabel = wfMessage( $buttonLabelKey )->text(); $attribs = [ -- 2.20.1