diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/WrapperTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/WrapperTest.php index 142c49a..d5803df 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/WrapperTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/WrapperTest.php @@ -33,7 +33,7 @@ public static function getInfo() { * Tests using the form in a usual way. */ function testWrapperCallback() { - $this->drupalGet('form_test/wrapper-callback'); + $this->drupalGet('form-test/wrapper-callback'); $this->assertText('Form wrapper callback element output.', 'The form contains form wrapper elements.'); $this->assertText('Form builder element output.', 'The form contains form builder elements.'); } 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 922bc78..38c8669 100644 --- a/core/modules/system/tests/modules/form_test/form_test.module +++ b/core/modules/system/tests/modules/form_test/form_test.module @@ -743,19 +743,6 @@ function form_label_test_form() { } /** - * Menu callback; Invokes a form builder function with a wrapper callback. - * - * @deprecated \Drupal\form_test\Controller\FormTestController::wrapperCallback() - */ -function form_test_wrapper_callback($form_id) { - $form_state = array( - 'build_info' => array('args' => array()), - 'wrapper_callback' => 'form_test_wrapper_callback_wrapper', - ); - return drupal_build_form($form_id, $form_state); -} - -/** * Form wrapper for form_test_wrapper_callback_form(). */ function form_test_wrapper_callback_wrapper($form, &$form_state) { 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 a37c9d8..a8c5104 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 @@ -69,7 +69,7 @@ form_test.autocomplete_2: _permission: 'access autocomplete test' form_test.wrapper: - path: '/form_test/wrapper-callback' + path: '/form-test/wrapper-callback' defaults: _title: 'Form wrapper callback test' _content: '\Drupal\form_test\Controller\FormTestController::wrapperCallback' 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 e897184..871575e 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 @@ -7,12 +7,41 @@ namespace Drupal\form_test\Controller; use Drupal\Core\Controller\ControllerBase; +use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Drupal\Core\Form\FormBuilderInterface; use Drupal\Core\Language\Language; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Controller routines for form_test routes. */ -class FormTestController extends ControllerBase { +class FormTestController extends ControllerBase implements ContainerInjectionInterface { + + /** + * The form builder. + * + * @var \Drupal\Core\Form\FormBuilderInterface + */ + protected $formBuilder; + + /** + * Constructs a new FormTestController. + * + * @param \Drupal\Core\Form\FormBuilderInterface $form_builder + * The form builder. + */ + public function __construct(FormBuilderInterface $form_builder) { + $this->formBuilder = $form_builder; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static( + $container->get('form_builder') + ); + } /** * Returns two instances of the node form. @@ -36,10 +65,14 @@ public function twoFormInstances() { } /** - * @todo Remove form_test_wrapper_callback(). + * Invokes a form builder function with a wrapper callback. */ public function wrapperCallback($form_id) { - return form_test_wrapper_callback($form_id); + $form_state = array( + 'build_info' => array('args' => array()), + 'wrapper_callback' => 'form_test_wrapper_callback_wrapper', + ); + return $this->formBuilder->buildForm($form_id, $form_state); } }