From fbbf5f9c781dc561d0444a5c24cb11c2e0d12e64 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Wed, 17 Jan 2018 17:32:38 +0100 Subject: [PATCH] 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 --- includes/EditPage.php | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) 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; -- 2.20.1