From: Bartosz Dziewoński Date: Wed, 17 Jan 2018 16:32:38 +0000 (+0100) Subject: EditPage: Simplify getEditButtons() X-Git-Tag: 1.31.0-rc.0~886^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=fbbf5f9c781dc561d0444a5c24cb11c2e0d12e64;p=lhc%2Fweb%2Fwiklou.git EditPage: Simplify getEditButtons() When this function supported both OOUI and non-OOUI buttons (before 478caa076f75fde935c66eb9334410d868c30818), using OOUI\Element::configFromHtmlAttributes() avoided some code duplication, but now it's just unnecessary. Change-Id: Ie941b9919e40b0a57d28ad76d1f0cc257456ce49 --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 62307b66c9..6b02c0fe00 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -4394,13 +4394,9 @@ class EditPage { $buttonLabel = $this->context->msg( $this->getSubmitButtonLabel() )->text(); - $attribs = [ - 'name' => 'wpSave', - 'tabindex' => ++$tabindex, - ]; - - $saveConfig = OOUI\Element::configFromHtmlAttributes( $attribs ); $buttons['save'] = new OOUI\ButtonInputWidget( [ + 'name' => 'wpSave', + 'tabIndex' => ++$tabindex, 'id' => 'wpSaveWidget', 'inputId' => 'wpSave', // Support: IE 6 – Use , otherwise it can't distinguish which button was clicked @@ -4411,15 +4407,11 @@ class EditPage { 'type' => 'submit', 'title' => Linker::titleAttrib( 'save' ), 'accessKey' => Linker::accesskey( 'save' ), - ] + $saveConfig ); - - $attribs = [ - 'name' => 'wpPreview', - 'tabindex' => ++$tabindex, - ]; + ] ); - $previewConfig = OOUI\Element::configFromHtmlAttributes( $attribs ); $buttons['preview'] = new OOUI\ButtonInputWidget( [ + 'name' => 'wpPreview', + 'tabIndex' => ++$tabindex, 'id' => 'wpPreviewWidget', 'inputId' => 'wpPreview', // Support: IE 6 – Use , otherwise it can't distinguish which button was clicked @@ -4429,15 +4421,11 @@ class EditPage { 'type' => 'submit', 'title' => Linker::titleAttrib( 'preview' ), 'accessKey' => Linker::accesskey( 'preview' ), - ] + $previewConfig ); - - $attribs = [ - 'name' => 'wpDiff', - 'tabindex' => ++$tabindex, - ]; + ] ); - $diffConfig = OOUI\Element::configFromHtmlAttributes( $attribs ); $buttons['diff'] = new OOUI\ButtonInputWidget( [ + 'name' => 'wpDiff', + 'tabIndex' => ++$tabindex, 'id' => 'wpDiffWidget', 'inputId' => 'wpDiff', // Support: IE 6 – Use , otherwise it can't distinguish which button was clicked @@ -4447,7 +4435,7 @@ class EditPage { 'type' => 'submit', 'title' => Linker::titleAttrib( 'diff' ), 'accessKey' => Linker::accesskey( 'diff' ), - ] + $diffConfig ); + ] ); // Avoid PHP 7.1 warning of passing $this by reference $editPage = $this;