Merge "Add canonical id to header on action=info"
[lhc/web/wiklou.git] / includes / EditPage.php
index 3e8473d..6be8771 100644 (file)
@@ -3059,7 +3059,7 @@ class EditPage {
                        'id' => 'wpSummary',
                        'name' => 'wpSummary',
                        'maxlength' => '200',
-                       'tabindex' => '1',
+                       'tabindex' => 1,
                        'size' => 60,
                        'spellcheck' => 'true',
                ] + Linker::tooltipAndAccesskeyAttribs( 'summary' );
@@ -3119,6 +3119,10 @@ class EditPage {
                        $this->getSummaryInputAttributes( $inputAttrs )
                );
 
+               // For compatibility with old scripts and extensions, we want the legacy 'id' on the `<input>`
+               $inputAttrs['inputId'] = $inputAttrs['id'];
+               $inputAttrs['id'] = 'wpSummaryWidget';
+
                return new OOUI\FieldLayout(
                        new OOUI\TextInputWidget( [
                                'value' => $summary,
@@ -4268,7 +4272,8 @@ HTML
                                new OOUI\CheckboxInputWidget( [
                                        'tabIndex' => ++$tabindex,
                                        'accessKey' => $accesskey,
-                                       'id' => $options['id'],
+                                       'id' => $options['id'] . 'Widget',
+                                       'inputId' => $options['id'],
                                        'name' => $name,
                                        'selected' => $options['default'],
                                        'infusable' => true,
@@ -4330,7 +4335,6 @@ HTML
                $buttonLabel = $this->context->msg( $this->getSaveButtonLabel() )->text();
 
                $attribs = [
-                       'id' => 'wpSave',
                        'name' => 'wpSave',
                        'tabindex' => ++$tabindex,
                ] + Linker::tooltipAndAccesskeyAttribs( 'save' );
@@ -4338,6 +4342,8 @@ HTML
                if ( $this->oouiEnabled ) {
                        $saveConfig = OOUI\Element::configFromHtmlAttributes( $attribs );
                        $buttons['save'] = new OOUI\ButtonInputWidget( [
+                               'id' => 'wpSaveWidget',
+                               'inputId' => 'wpSave',
                                // Support: IE 6 – Use <input>, otherwise it can't distinguish which button was clicked
                                'useInputTag' => true,
                                'flags' => [ 'constructive', 'primary' ],
@@ -4348,19 +4354,20 @@ HTML
                } else {
                        $buttons['save'] = Html::submitButton(
                                $buttonLabel,
-                               $attribs,
+                               $attribs + [ 'id' => 'wpSave' ],
                                [ 'mw-ui-progressive' ]
                        );
                }
 
                $attribs = [
-                       'id' => 'wpPreview',
                        'name' => 'wpPreview',
                        'tabindex' => ++$tabindex,
                ] + Linker::tooltipAndAccesskeyAttribs( 'preview' );
                if ( $this->oouiEnabled ) {
                        $previewConfig = OOUI\Element::configFromHtmlAttributes( $attribs );
                        $buttons['preview'] = new OOUI\ButtonInputWidget( [
+                               'id' => 'wpPreviewWidget',
+                               'inputId' => 'wpPreview',
                                // Support: IE 6 – Use <input>, otherwise it can't distinguish which button was clicked
                                'useInputTag' => true,
                                'label' => $this->context->msg( 'showpreview' )->text(),
@@ -4370,17 +4377,18 @@ HTML
                } else {
                        $buttons['preview'] = Html::submitButton(
                                $this->context->msg( 'showpreview' )->text(),
-                               $attribs
+                               $attribs + [ 'id' => 'wpPreview' ]
                        );
                }
                $attribs = [
-                       'id' => 'wpDiff',
                        'name' => 'wpDiff',
                        'tabindex' => ++$tabindex,
                ] + Linker::tooltipAndAccesskeyAttribs( 'diff' );
                if ( $this->oouiEnabled ) {
                        $diffConfig = OOUI\Element::configFromHtmlAttributes( $attribs );
                        $buttons['diff'] = new OOUI\ButtonInputWidget( [
+                               'id' => 'wpDiffWidget',
+                               'inputId' => 'wpDiff',
                                // Support: IE 6 – Use <input>, otherwise it can't distinguish which button was clicked
                                'useInputTag' => true,
                                'label' => $this->context->msg( 'showdiff' )->text(),
@@ -4390,7 +4398,7 @@ HTML
                } else {
                        $buttons['diff'] = Html::submitButton(
                                $this->context->msg( 'showdiff' )->text(),
-                               $attribs
+                               $attribs + [ 'id' => 'wpDiff' ]
                        );
                }