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
$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 = [