diff --git a/core/modules/system/tests/modules/form_test/form_test.module b/core/modules/system/tests/modules/form_test/form_test.module index a3d1cd0..bf8b101 100644 --- a/core/modules/system/tests/modules/form_test/form_test.module +++ b/core/modules/system/tests/modules/form_test/form_test.module @@ -2057,34 +2057,6 @@ function form_test_required_attribute($form, &$form_state) { } /** - * Menu callback returns two instances of the same form. - * - * @deprecated \Drupal\form_test\Controller\FormTestController::doubleForm() - */ -function form_test_double_form() { - return array( - 'form1' => drupal_get_form('form_test_html_id'), - 'form2' => drupal_get_form('form_test_html_id'), - ); -} - -/** - * Builds a simple form to test duplicate HTML IDs. - */ -function form_test_html_id($form, &$form_state) { - $form['name'] = array( - '#type' => 'textfield', - '#title' => 'name', - '#required' => TRUE, - ); - $form['submit'] = array( - '#type' => 'submit', - '#value' => 'Save', - ); - return $form; -} - -/** * Builds a simple form to test form button classes. * * @deprecated Use \Drupal\form_test\testButtonClass() diff --git a/core/modules/system/tests/modules/form_test/form_test.routing.yml b/core/modules/system/tests/modules/form_test/form_test.routing.yml index f8467ff..26eab9c 100644 --- a/core/modules/system/tests/modules/form_test/form_test.routing.yml +++ b/core/modules/system/tests/modules/form_test/form_test.routing.yml @@ -81,7 +81,7 @@ form_test.double_form: path: '/form-test/double-form' defaults: _title: 'Double form test' - _content: '\Drupal\form_test\Controller\FormTestController::doubleForm' + _content: '\Drupal\form_test\Controller\FormTestController::twoIdenticalFormInstances' requirements: _access: 'TRUE' diff --git a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/Controller/FormTestController.php b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/Controller/FormTestController.php index 40dd178..f9bf52c 100644 --- a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/Controller/FormTestController.php +++ b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/Controller/FormTestController.php @@ -8,6 +8,7 @@ use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Language\Language; +use Drupal\form_test\Form\FormTestHtmlIdForm; /** * Controller routines for form_test routes. @@ -43,10 +44,16 @@ public function wrapperCallback($form_id) { } /** - * @todo Remove form_test_double_form(). + * Returns two instances of the same form. + * + * @return array + * A render array containing two identical forms. */ - public function doubleForm() { - return form_test_double_form(); + public function twoIdenticalFormInstances() { + return array( + 'form1' => drupal_get_form(new FormTestHtmlIdForm()), + 'form2' => drupal_get_form(new FormTestHtmlIdForm()), + ); } } diff --git a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/Form/FormTestHtmlIdForm.php b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/Form/FormTestHtmlIdForm.php new file mode 100644 index 0000000..a1bcdd8 --- /dev/null +++ b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/Form/FormTestHtmlIdForm.php @@ -0,0 +1,46 @@ + 'textfield', + '#title' => 'name', + '#required' => TRUE, + ); + $form['submit'] = array( + '#type' => 'submit', + '#value' => 'Save', + ); + return $form; + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, array &$form_state) { + } + +}