Bartosz Dziewoński has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/344793 )
Change subject: EditPage: Minor code style improvements ...................................................................... EditPage: Minor code style improvements Mostly whitespace fixes. Avoiding some temporary variables. Change-Id: I65f31f2bdd01ab677caff5f628222993ad719c2f --- M includes/EditPage.php 1 file changed, 28 insertions(+), 24 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/93/344793/1 diff --git a/includes/EditPage.php b/includes/EditPage.php index 7a58326..ac62e3f 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -3058,6 +3058,7 @@ */ protected function showSummaryInput( $isSubjectPreview, $summary = "" ) { global $wgOut; + # Add a class if 'missingsummary' is triggered to allow styling of the summary line $summaryClass = $this->missingSummary ? 'mw-summarymissed' : 'mw-summary'; if ( $isSubjectPreview ) { @@ -3506,12 +3507,12 @@ $message = $this->context->msg( 'edithelppage' )->inContentLanguage()->text(); $edithelpurl = Skin::makeInternalOrExternalUrl( $message ); - $attrs = [ - 'target' => 'helpwindow', - 'href' => $edithelpurl, - ]; - $edithelp = Html::linkButton( $this->context->msg( 'edithelp' )->text(), - $attrs, [ 'mw-ui-quiet' ] ) . + $edithelp = + Html::linkButton( + $this->context->msg( 'edithelp' )->text(), + [ 'target' => 'helpwindow', 'href' => $edithelpurl ], + [ 'mw-ui-quiet' ] + ) . $this->context->msg( 'word-separator' )->escaped() . $this->context->msg( 'newwindow' )->parse(); @@ -3571,18 +3572,16 @@ */ public function getCancelLink() { $cancelParams = []; - $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer(); if ( !$this->isConflict && $this->oldid > 0 ) { $cancelParams['oldid'] = $this->oldid; } elseif ( $this->getContextTitle()->isRedirect() ) { $cancelParams['redirect'] = 'no'; } - $attrs = [ 'id' => 'mw-editform-cancel' ]; - return $linkRenderer->makeKnownLink( + return MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink( $this->getContextTitle(), new HtmlArmor( $this->context->msg( 'cancel' )->parse() ), - Html::buttonAttributes( $attrs, [ 'mw-ui-quiet' ] ), + Html::buttonAttributes( [ 'id' => 'mw-editform-cancel' ], [ 'mw-ui-quiet' ] ), $cancelParams ); } @@ -4038,9 +4037,8 @@ ">{$minorLabel}</label>"; if ( $wgUseMediaWikiUIEverywhere ) { - $checkboxes['minor'] = Html::openElement( 'div', [ 'class' => 'mw-ui-checkbox' ] ) . - $minorEditHtml . - Html::closeElement( 'div' ); + $checkboxes['minor'] = + Html::rawElement( 'div', [ 'class' => 'mw-ui-checkbox' ], $minorEditHtml ); } else { $checkboxes['minor'] = $minorEditHtml; } @@ -4061,9 +4059,8 @@ Xml::expandAttributes( [ 'title' => Linker::titleAttrib( 'watch', 'withaccess' ) ] ) . ">{$watchLabel}</label>"; if ( $wgUseMediaWikiUIEverywhere ) { - $checkboxes['watch'] = Html::openElement( 'div', [ 'class' => 'mw-ui-checkbox' ] ) . - $watchThisHtml . - Html::closeElement( 'div' ); + $checkboxes['watch'] = + Html::rawElement( 'div', [ 'class' => 'mw-ui-checkbox' ], $watchThisHtml ); } else { $checkboxes['watch'] = $watchThisHtml; } @@ -4095,34 +4092,41 @@ } else { $buttonLabelKey = !$this->mTitle->exists() ? 'savearticle' : 'savechanges'; } - $buttonLabel = $this->context->msg( $buttonLabelKey )->text(); $attribs = [ 'id' => 'wpSave', 'name' => 'wpSave', 'tabindex' => ++$tabindex, ] + Linker::tooltipAndAccesskeyAttribs( 'save' ); - $buttons['save'] = Html::submitButton( $buttonLabel, $attribs, [ 'mw-ui-progressive' ] ); + $buttons['save'] = Html::submitButton( + $this->context->msg( $buttonLabelKey )->text(), + $attribs, + [ 'mw-ui-progressive' ] + ); - ++$tabindex; // use the same for preview and live preview $attribs = [ 'id' => 'wpPreview', 'name' => 'wpPreview', - 'tabindex' => $tabindex, + 'tabindex' => ++$tabindex, ] + Linker::tooltipAndAccesskeyAttribs( 'preview' ); - $buttons['preview'] = Html::submitButton( $this->context->msg( 'showpreview' )->text(), - $attribs ); + $buttons['preview'] = Html::submitButton( + $this->context->msg( 'showpreview' )->text(), + $attribs + ); $attribs = [ 'id' => 'wpDiff', 'name' => 'wpDiff', 'tabindex' => ++$tabindex, ] + Linker::tooltipAndAccesskeyAttribs( 'diff' ); - $buttons['diff'] = Html::submitButton( $this->context->msg( 'showdiff' )->text(), - $attribs ); + $buttons['diff'] = Html::submitButton( + $this->context->msg( 'showdiff' )->text(), + $attribs + ); // Avoid PHP 7.1 warning of passing $this by reference $editPage = $this; Hooks::run( 'EditPageBeforeEditButtons', [ &$editPage, &$buttons, &$tabindex ] ); + return $buttons; } -- To view, visit https://gerrit.wikimedia.org/r/344793 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I65f31f2bdd01ab677caff5f628222993ad719c2f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits