diff -u b/core/modules/outside_in/src/OffCanvasFormDialogTrait.php b/core/modules/outside_in/src/OffCanvasFormDialogTrait.php --- b/core/modules/outside_in/src/OffCanvasFormDialogTrait.php +++ b/core/modules/outside_in/src/OffCanvasFormDialogTrait.php @@ -29,7 +29,7 @@ return (in_array($wrapper_format, [ 'drupal_ajax', 'drupal_modal', - 'drupal_dialog_offcanvas', + 'drupal_dialog_off_canvas', ])) ? TRUE : FALSE; } @@ -132,7 +132,7 @@ */ public function closeDialog(array &$form, FormStateInterface $form_state) { $response = new AjaxResponse(); - $response->addCommand(new CloseDialogCommand('#drupal-offcanvas')); + $response->addCommand(new CloseDialogCommand('#drupal-off-canvas')); return $response; } diff -u b/core/modules/outside_in/tests/modules/off_canvas_test/off_canvas_test.routing.yml b/core/modules/outside_in/tests/modules/off_canvas_test/off_canvas_test.routing.yml --- b/core/modules/outside_in/tests/modules/off_canvas_test/off_canvas_test.routing.yml +++ b/core/modules/outside_in/tests/modules/off_canvas_test/off_canvas_test.routing.yml @@ -29,8 +29,8 @@ _access: 'TRUE' -offcanvas_test.form: - path: '/offcanvas-form' +off_canvas_test.form: + path: '/off-canvas-form' defaults: - _form: '\Drupal\offcanvas_test\Form\TestForm' + _form: '\Drupal\off_canvas_test\Form\TestForm' requirements: _access: 'TRUE' diff -u b/core/modules/outside_in/tests/modules/off_canvas_test/src/Controller/TestController.php b/core/modules/outside_in/tests/modules/off_canvas_test/src/Controller/TestController.php --- b/core/modules/outside_in/tests/modules/off_canvas_test/src/Controller/TestController.php +++ b/core/modules/outside_in/tests/modules/off_canvas_test/src/Controller/TestController.php @@ -92,18 +92,18 @@ ], ], ], - 'offcanvas_form' => [ + 'off_canvas_form' => [ '#title' => 'Show form!', '#type' => 'link', '#url' => Url::fromRoute( - 'offcanvas_test.form', + 'off_canvas_test.form', [], - ['query' => ['destination' => 'offcanvas-test-links']] + ['query' => ['destination' => 'off-canvas-test-links']] ), '#attributes' => [ 'class' => ['use-ajax'], 'data-dialog-type' => 'dialog', - 'data-dialog-renderer' => 'offcanvas', + 'data-dialog-renderer' => 'off_canvas', ], '#attached' => [ 'library' => [ reverted: --- b/core/modules/outside_in/tests/modules/offcanvas_test/src/Form/TestForm.php +++ /dev/null @@ -1,69 +0,0 @@ - 'checkbox', - '#title' => $this->t('Force error?'), - ]; - $form['actions'] = [ - '#type' => 'actions', - 'submit' => [ - '#type' => 'submit', - '#value' => $this->t('Submit'), - ], - 'cancel' => [ - '#type' => 'submit', - '#value' => $this->t('Cancel'), - ], - ]; - $this->buildFormDialog($form, $form_state); - return $form; - } - - /** - * {@inheritdoc} - */ - public function validateForm(array &$form, FormStateInterface $form_state) { - parent::validateForm($form, $form_state); - if ($form_state->getValue('force_error')) { - $form_state->setErrorByName('force_error', 'Validation error'); - } - } - - /** - * Form submission handler. - * - * @param array $form - * An associative array containing the structure of the form. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The current state of the form. - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - drupal_set_message('submitted'); - } - -} diff -u b/core/modules/outside_in/tests/src/FunctionalJavascript/OffCanvasTest.php b/core/modules/outside_in/tests/src/FunctionalJavascript/OffCanvasTest.php --- b/core/modules/outside_in/tests/src/FunctionalJavascript/OffCanvasTest.php +++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OffCanvasTest.php @@ -111,7 +111,7 @@ $page = $this->getSession()->getPage(); // First submit form with no error. - $this->drupalGet('/offcanvas-test-links'); + $this->drupalGet('/off-canvas-test-links'); $page->clickLink('Show form!'); $this->waitForOffCanvasToOpen(); $page->pressButton('Submit'); @@ -124,14 +124,14 @@ $web_assert->elementNotContains('css', 'body', 'Validation error'); // Then submit form with error. - $this->drupalGet('/offcanvas-test-links'); + $this->drupalGet('/off-canvas-test-links'); $page->clickLink('Show form!'); $this->waitForOffCanvasToOpen(); $page->checkField('Force error?'); $page->pressButton('Submit'); $web_assert->assertWaitOnAjaxRequest(); $web_assert->elementNotContains('css', 'body', 'submitted'); - $web_assert->elementContains('css', '#drupal-offcanvas', 'Validation error'); + $web_assert->elementContains('css', '#drupal-off-canvas', 'Validation error'); } } only in patch2: unchanged: --- /dev/null +++ b/core/modules/outside_in/tests/modules/off_canvas_test/src/Form/TestForm.php @@ -0,0 +1,69 @@ + 'checkbox', + '#title' => $this->t('Force error?'), + ]; + $form['actions'] = [ + '#type' => 'actions', + 'submit' => [ + '#type' => 'submit', + '#value' => $this->t('Submit'), + ], + 'cancel' => [ + '#type' => 'submit', + '#value' => $this->t('Cancel'), + ], + ]; + $this->buildFormDialog($form, $form_state); + return $form; + } + + /** + * {@inheritdoc} + */ + public function validateForm(array &$form, FormStateInterface $form_state) { + parent::validateForm($form, $form_state); + if ($form_state->getValue('force_error')) { + $form_state->setErrorByName('force_error', 'Validation error'); + } + } + + /** + * Form submission handler. + * + * @param array $form + * An associative array containing the structure of the form. + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The current state of the form. + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + drupal_set_message('submitted'); + } + +}