From: Jforrester Date: Wed, 24 Aug 2016 23:19:36 +0000 (+0000) Subject: EditPage: Don't show create label for the button on new sections X-Git-Tag: 1.31.0-rc.0~5881^2 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=d7da3e44528b9ba16391e101c841da17c1a3fed9;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 = [