diff --git a/core/lib/Drupal/Core/EventSubscriber/RouteProcessorSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/RouteProcessorSubscriber.php index 0061530..f965360 100644 --- a/core/lib/Drupal/Core/EventSubscriber/RouteProcessorSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/RouteProcessorSubscriber.php @@ -38,8 +38,18 @@ public function __construct(ContentNegotiation $negotiation) { public function onRequestSetController(GetResponseEvent $event) { $request = $event->getRequest(); + // @todo This should all get converted into one or more RouteEnhancers. if (!$request->attributes->has('_controller') && $this->negotiation->getContentType($request) === 'html') { - $request->attributes->set('_controller', '\Drupal\Core\HtmlPageController::content'); + if ($request->attributes->has('_form')) { + $request->attributes->set('_controller', '\Drupal\Core\HtmlFormController::content'); + } + elseif ($request->attributes->has('_content')) { + $request->attributes->set('_controller', '\Drupal\Core\HtmlPageController::content'); + } + else { + throw new \InvalidArgumentException('No valid subcontroller key was found'); + } + } } diff --git a/core/lib/Drupal/Core/HtmlFormController.php b/core/lib/Drupal/Core/HtmlFormController.php new file mode 100644 index 0000000..b641341 --- /dev/null +++ b/core/lib/Drupal/Core/HtmlFormController.php @@ -0,0 +1,81 @@ +container = $container; + } + + /** + * Controller method for generic HTML form pages. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * The request object. + * @param callable $_form + * The name of the form class for this request. + * + * @return \Symfony\Component\HttpFoundation\Response + * A response object. + */ + public function content(Request $request, $_form) { + // If this is a class, instantiate it. + if (class_exists($_form)) { + if (in_array('Drupal\Core\ControllerInterface', class_implements($_form))) { + $form_arg = $_form::create($this->container); + } + else { + $form_arg = new $_form(); + } + } + // Otherwise, it is a service. + else { + $form_arg = $this->container->get($_form); + } + + // Using reflection, find all of the parameters needed by the form in the + // request attributes, skipping $form and $form_state. + $attributes = $request->attributes->all(); + $reflection = new \ReflectionMethod($form_arg, 'buildForm'); + $params = $reflection->getParameters(); + $args = array(); + foreach (array_splice($params, 2) as $param) { + if (array_key_exists($param->name, $attributes)) { + $args[] = $attributes[$param->name]; + } + } + $form_state['build_info']['args'] = $args; + + $form_id = _drupal_form_id($form_arg, $form_state); + $form = drupal_build_form($form_id, $form_state); + return new Response(drupal_render_page($form)); + } + +} diff --git a/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php b/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php index b415a70..967ab01 100644 --- a/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php +++ b/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php @@ -8,11 +8,40 @@ namespace Drupal\system; use Drupal\Core\Form\FormInterface; +use Drupal\Core\ControllerInterface; +use Drupal\Core\Config\ConfigFactory; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Base class for implementing system configuration forms. */ -abstract class SystemConfigFormBase implements FormInterface { +abstract class SystemConfigFormBase implements FormInterface, ControllerInterface { + + /** + * Stores the configuration factory. + * + * @var \Drupal\Core\Config\ConfigFactory + */ + protected $configFactory; + + /** + * Constructs a \Drupal\system\SystemConfigFormBase object. + * + * @param \Drupal\Core\Config\ConfigFactory $config_factory + * The factory for configuration objects. + */ + public function __construct(ConfigFactory $config_factory) { + $this->configFactory = $config_factory; + } + + /** + * Implements \Drupal\Core\ControllerInterface::create(). + */ + public static function create(ContainerInterface $container) { + return new static( + $container->get('config.factory') + ); + } /** * Implements \Drupal\Core\Form\FormInterface::buildForm(). diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/FormObjectTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/FormObjectTest.php index cf2fe24..39a9b86 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/FormObjectTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/FormObjectTest.php @@ -47,13 +47,48 @@ protected function setUp() { * Tests using an object as the form callback. */ function testObjectFormCallback() { + $config_factory = $this->container->get('config.factory'); + $this->drupalGet('form-test/object-builder'); $this->assertText('The FormTestObject::buildForm() method was used for this form.'); $elements = $this->xpath('//form[@id="form-test-form-test-object"]'); $this->assertTrue(!empty($elements), 'The correct form ID was used.'); - $this->drupalPost('form-test/object-builder', NULL, t('Save')); + $this->drupalPost(NULL, array('bananas' => 'green'), t('Save')); $this->assertText('The FormTestObject::validateForm() method was used for this form.'); $this->assertText('The FormTestObject::submitForm() method was used for this form.'); + $value = $config_factory->get('form_test.object')->get('bananas'); + $this->assertIdentical('green', $value); + + $this->drupalGet('form-test/object-arguments-builder/yellow'); + $this->assertText('The FormTestArgumentsObject::buildForm() method was used for this form.'); + $elements = $this->xpath('//form[@id="form-test-form-test-arguments-object"]'); + $this->assertTrue(!empty($elements), 'The correct form ID was used.'); + $this->drupalPost(NULL, NULL, t('Save')); + $this->assertText('The FormTestArgumentsObject::validateForm() method was used for this form.'); + $this->assertText('The FormTestArgumentsObject::submitForm() method was used for this form.'); + $value = $config_factory->get('form_test.object')->get('bananas'); + $this->assertIdentical('yellow', $value); + + $this->drupalGet('form-test/object-service-builder'); + $this->assertText('The FormTestServiceObject::buildForm() method was used for this form.'); + $elements = $this->xpath('//form[@id="form-test-form-test-service-object"]'); + $this->assertTrue(!empty($elements), 'The correct form ID was used.'); + $this->drupalPost(NULL, array('bananas' => 'brown'), t('Save')); + $this->assertText('The FormTestServiceObject::validateForm() method was used for this form.'); + $this->assertText('The FormTestServiceObject::submitForm() method was used for this form.'); + $value = $config_factory->get('form_test.object')->get('bananas'); + $this->assertIdentical('brown', $value); + + $this->drupalGet('form-test/object-controller-builder'); + $this->assertText('The FormTestControllerObject::create() method was used for this form.'); + $this->assertText('The FormTestControllerObject::buildForm() method was used for this form.'); + $elements = $this->xpath('//form[@id="form-test-form-test-controller-object"]'); + $this->assertTrue(!empty($elements), 'The correct form ID was used.'); + $this->drupalPost(NULL, array('bananas' => 'black'), t('Save')); + $this->assertText('The FormTestControllerObject::validateForm() method was used for this form.'); + $this->assertText('The FormTestControllerObject::submitForm() method was used for this form.'); + $value = $config_factory->get('form_test.object')->get('bananas'); + $this->assertIdentical('black', $value); } } diff --git a/core/modules/system/tests/modules/condition_test/condition_test.routing.yml b/core/modules/system/tests/modules/condition_test/condition_test.routing.yml index 96fbdca..d242511 100644 --- a/core/modules/system/tests/modules/condition_test/condition_test.routing.yml +++ b/core/modules/system/tests/modules/condition_test/condition_test.routing.yml @@ -1,6 +1,6 @@ condition_test_1: pattern: '/condition_test' defaults: - _controller: '\Drupal\condition_test\FormController::getForm' + _form: '\Drupal\condition_test\FormController' requirements: _access: 'TRUE' diff --git a/core/modules/system/tests/modules/condition_test/lib/Drupal/condition_test/FormController.php b/core/modules/system/tests/modules/condition_test/lib/Drupal/condition_test/FormController.php index 03b918e..93c3603 100644 --- a/core/modules/system/tests/modules/condition_test/lib/Drupal/condition_test/FormController.php +++ b/core/modules/system/tests/modules/condition_test/lib/Drupal/condition_test/FormController.php @@ -30,12 +30,11 @@ public function getFormID() { } /** - * Provides a simple method the router can fire in order to invoke this form. + * Constructs a \Drupal\condition_test\FormController object. */ - public function getForm() { + public function __construct() { $manager = new ConditionManager(drupal_container()->getParameter('container.namespaces')); $this->condition = $manager->createInstance('node_type'); - return drupal_get_form($this); } /** 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 fe5d999..3a0ecaf 100644 --- a/core/modules/system/tests/modules/form_test/form_test.module +++ b/core/modules/system/tests/modules/form_test/form_test.module @@ -28,12 +28,6 @@ function form_test_menu() { 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); - $items['form-test/object-builder'] = array( - 'title' => 'Form object builder test', - 'page callback' => 'form_test_object_builder', - 'access callback' => TRUE, - 'type' => MENU_CALLBACK, - ); $items['form-test/system-config-form'] = array( 'title' => 'Form object builder test', 'page callback' => 'form_test_system_config_form', @@ -377,13 +371,6 @@ function form_test_permission() { } /** - * Page callback: Displays a form built from an object. - */ -function form_test_object_builder() { - return drupal_get_form(new FormTestObject()); -} - -/** * Page callback: Displays a form built from SystemConfigForm. */ function form_test_system_config_form() { 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 new file mode 100644 index 0000000..826e737 --- /dev/null +++ b/core/modules/system/tests/modules/form_test/form_test.routing.yml @@ -0,0 +1,27 @@ +form_test.route1: + pattern: '/form-test/object-builder' + defaults: + _form: '\Drupal\form_test\FormTestObject' + requirements: + _access: 'TRUE' + +form_test.route2: + pattern: '/form-test/object-arguments-builder/{arg}' + defaults: + _form: '\Drupal\form_test\FormTestArgumentsObject' + requirements: + _access: 'TRUE' + +form_test.route3: + pattern: '/form-test/object-service-builder' + defaults: + _form: 'form_test.form.serviceForm' + requirements: + _access: 'TRUE' + +form_test.route4: + pattern: '/form-test/object-controller-builder' + defaults: + _form: '\Drupal\form_test\FormTestControllerObject' + requirements: + _access: 'TRUE' diff --git a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestArgumentsObject.php b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestArgumentsObject.php new file mode 100644 index 0000000..ee13968 --- /dev/null +++ b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestArgumentsObject.php @@ -0,0 +1,61 @@ + 'The FormTestArgumentsObject::buildForm() method was used for this form.'); + + $form['bananas'] = array( + '#type' => 'textfield', + '#default_value' => check_plain($arg), + '#title' => t('Bananas'), + ); + + $form['actions']['#type'] = 'actions'; + $form['actions']['submit'] = array( + '#type' => 'submit', + '#value' => t('Save'), + ); + return $form; + } + + /** + * Implements \Drupal\Core\Form\FormInterface::validateForm(). + */ + public function validateForm(array &$form, array &$form_state) { + drupal_set_message(t('The FormTestArgumentsObject::validateForm() method was used for this form.')); + } + + /** + * Implements \Drupal\Core\Form\FormInterface::submitForm(). + */ + public function submitForm(array &$form, array &$form_state) { + drupal_set_message(t('The FormTestArgumentsObject::submitForm() method was used for this form.')); + config('form_test.object') + ->set('bananas', $form_state['values']['bananas']) + ->save(); + } + +} diff --git a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestBundle.php b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestBundle.php new file mode 100644 index 0000000..0ccf9d8 --- /dev/null +++ b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestBundle.php @@ -0,0 +1,26 @@ +register('form_test.form.serviceForm', 'Drupal\form_test\FormTestServiceObject'); + } + +} diff --git a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestControllerObject.php b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestControllerObject.php new file mode 100644 index 0000000..38a8fc7 --- /dev/null +++ b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestControllerObject.php @@ -0,0 +1,70 @@ + 'The FormTestControllerObject::buildForm() method was used for this form.'); + + $form['bananas'] = array( + '#type' => 'textfield', + '#title' => t('Bananas'), + ); + + $form['actions']['#type'] = 'actions'; + $form['actions']['submit'] = array( + '#type' => 'submit', + '#value' => t('Save'), + ); + return $form; + } + + /** + * Implements \Drupal\Core\Form\FormInterface::validateForm(). + */ + public function validateForm(array &$form, array &$form_state) { + drupal_set_message(t('The FormTestControllerObject::validateForm() method was used for this form.')); + } + + /** + * Implements \Drupal\Core\Form\FormInterface::submitForm(). + */ + public function submitForm(array &$form, array &$form_state) { + drupal_set_message(t('The FormTestControllerObject::submitForm() method was used for this form.')); + config('form_test.object') + ->set('bananas', $form_state['values']['bananas']) + ->save(); + } + +} diff --git a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestServiceObject.php b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestServiceObject.php new file mode 100644 index 0000000..c7663ef --- /dev/null +++ b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestServiceObject.php @@ -0,0 +1,61 @@ + 'The FormTestServiceObject::buildForm() method was used for this form.'); + + $form['bananas'] = array( + '#type' => 'textfield', + '#default_value' => 'brown', + '#title' => t('Bananas'), + ); + + $form['actions']['#type'] = 'actions'; + $form['actions']['submit'] = array( + '#type' => 'submit', + '#value' => t('Save'), + ); + return $form; + } + + /** + * Implements \Drupal\Core\Form\FormInterface::validateForm(). + */ + public function validateForm(array &$form, array &$form_state) { + drupal_set_message(t('The FormTestServiceObject::validateForm() method was used for this form.')); + } + + /** + * Implements \Drupal\Core\Form\FormInterface::submitForm(). + */ + public function submitForm(array &$form, array &$form_state) { + drupal_set_message(t('The FormTestServiceObject::submitForm() method was used for this form.')); + config('form_test.object') + ->set('bananas', $form_state['values']['bananas']) + ->save(); + } + +} diff --git a/core/modules/views/views_ui/lib/Drupal/views_ui/Form/AdvancedSettingsForm.php b/core/modules/views/views_ui/lib/Drupal/views_ui/Form/AdvancedSettingsForm.php index 3be09d4..c638cf3 100644 --- a/core/modules/views/views_ui/lib/Drupal/views_ui/Form/AdvancedSettingsForm.php +++ b/core/modules/views/views_ui/lib/Drupal/views_ui/Form/AdvancedSettingsForm.php @@ -7,10 +7,12 @@ namespace Drupal\views_ui\Form; +use Drupal\system\SystemConfigFormBase; + /** * Form builder for the advanced admin settings page. */ -class AdvancedSettingsForm extends SettingsFormBase { +class AdvancedSettingsForm extends SystemConfigFormBase { /** * Implements \Drupal\Core\Form\FormInterface::getFormID(). @@ -25,6 +27,7 @@ public function getFormID() { public function buildForm(array $form, array &$form_state) { $form = parent::buildForm($form, $form_state); + $config = $this->configFactory->get('views.settings'); $form['cache'] = array( '#type' => 'details', '#title' => t('Caching'), @@ -34,7 +37,7 @@ public function buildForm(array $form, array &$form_state) { '#type' => 'checkbox', '#title' => t('Disable views data caching'), '#description' => t("Views caches data about tables, modules and views available, to increase performance. By checking this box, Views will skip this cache and always rebuild this data when needed. This can have a serious performance impact on your site."), - '#default_value' => $this->config->get('skip_cache'), + '#default_value' => $config->get('skip_cache'), ); $form['cache']['clear_cache'] = array( @@ -53,14 +56,14 @@ public function buildForm(array $form, array &$form_state) { '#title' => t('Add Views signature to all SQL queries'), '#description' => t("All Views-generated queries will include the name of the views and display 'view-name:display-name' as a string at the end of the SELECT clause. This makes identifying Views queries in database server logs simpler, but should only be used when troubleshooting."), - '#default_value' => $this->config->get('sql_signature'), + '#default_value' => $config->get('sql_signature'), ); $form['debug']['no_javascript'] = array( '#type' => 'checkbox', '#title' => t('Disable JavaScript with Views'), '#description' => t("If you are having problems with the JavaScript, you can disable it here. The Views UI should degrade and still be usable without javascript; it's just not as good."), - '#default_value' => $this->config->get('no_javascript'), + '#default_value' => $config->get('no_javascript'), ); $options = views_fetch_plugin_names('display_extender'); @@ -70,7 +73,7 @@ public function buildForm(array $form, array &$form_state) { ); $form['extenders']['display_extenders'] = array( '#title' => t('Display extenders'), - '#default_value' => array_filter($this->config->get('display_extenders')), + '#default_value' => array_filter($config->get('display_extenders')), '#options' => $options, '#type' => 'checkboxes', '#description' => t('Select extensions of the views interface.') @@ -84,7 +87,7 @@ public function buildForm(array $form, array &$form_state) { * Implements \Drupal\Core\Form\FormInterface::submitForm(). */ public function submitForm(array &$form, array &$form_state) { - $this->config + $this->configFactory->get('views.settings') ->set('skip_cache', $form_state['values']['skip_cache']) ->set('sql_signature', $form_state['values']['sql_signature']) ->set('no_javascript', $form_state['values']['no_javascript']) diff --git a/core/modules/views/views_ui/lib/Drupal/views_ui/Form/BasicSettingsForm.php b/core/modules/views/views_ui/lib/Drupal/views_ui/Form/BasicSettingsForm.php index 082eaa3..9631e38 100644 --- a/core/modules/views/views_ui/lib/Drupal/views_ui/Form/BasicSettingsForm.php +++ b/core/modules/views/views_ui/lib/Drupal/views_ui/Form/BasicSettingsForm.php @@ -7,10 +7,12 @@ namespace Drupal\views_ui\Form; +use Drupal\system\SystemConfigFormBase; + /** * Form builder for the admin display defaults page. */ -class BasicSettingsForm extends SettingsFormBase { +class BasicSettingsForm extends SystemConfigFormBase { /** * Implements \Drupal\Core\Form\FormInterface::getFormID(). @@ -25,6 +27,7 @@ public function getFormID() { public function buildForm(array $form, array &$form_state) { $form = parent::buildForm($form, $form_state); + $config = $this->configFactory->get('views.settings'); $options = array(); foreach (list_themes() as $name => $theme) { if ($theme->status) { @@ -40,28 +43,28 @@ public function buildForm(array $form, array &$form_state) { '#type' => 'checkbox', '#title' => t('Always show the master display'), '#description' => t('Advanced users of views may choose to see the master (i.e. default) display.'), - '#default_value' => $this->config->get('ui.show.master_display'), + '#default_value' => $config->get('ui.show.master_display'), ); $form['basic']['ui_show_advanced_column'] = array( '#type' => 'checkbox', '#title' => t('Always show advanced display settings'), '#description' => t('Default to showing advanced display settings, such as relationships and contextual filters.'), - '#default_value' => $this->config->get('ui.show.advanced_column'), + '#default_value' => $config->get('ui.show.advanced_column'), ); $form['basic']['ui_show_display_embed'] = array( '#type' => 'checkbox', '#title' => t('Show the embed display in the ui.'), '#description' => t('Allow advanced user to use the embed view display. The plugin itself works if it\'s not visible in the ui'), - '#default_value' => $this->config->get('ui.show.display_embed'), + '#default_value' => $config->get('ui.show.display_embed'), ); $form['basic']['ui_exposed_filter_any_label'] = array( '#type' => 'select', '#title' => t('Label for "Any" value on non-required single-select exposed filters'), '#options' => array('old_any' => '', 'new_any' => t('- Any -')), - '#default_value' => $this->config->get('ui.exposed_filter_any_label'), + '#default_value' => $config->get('ui.exposed_filter_any_label'), ); $form['live_preview'] = array( @@ -72,13 +75,13 @@ public function buildForm(array $form, array &$form_state) { $form['live_preview']['ui_always_live_preview'] = array( '#type' => 'checkbox', '#title' => t('Automatically update preview on changes'), - '#default_value' => $this->config->get('ui.always_live_preview'), + '#default_value' => $config->get('ui.always_live_preview'), ); $form['live_preview']['ui_show_preview_information'] = array( '#type' => 'checkbox', '#title' => t('Show information and statistics about the view during live preview'), - '#default_value' => $this->config->get('ui.show.preview_information'), + '#default_value' => $config->get('ui.show.preview_information'), ); $form['live_preview']['options'] = array( @@ -96,25 +99,25 @@ public function buildForm(array $form, array &$form_state) { 'above' => t('Above the preview'), 'below' => t('Below the preview'), ), - '#default_value' => $this->config->get('ui.show.sql_query.where'), + '#default_value' => $config->get('ui.show.sql_query.where'), ); $form['live_preview']['options']['ui_show_sql_query_enabled'] = array( '#type' => 'checkbox', '#title' => t('Show the SQL query'), - '#default_value' => $this->config->get('ui.show.sql_query.enabled'), + '#default_value' => $config->get('ui.show.sql_query.enabled'), ); $form['live_preview']['options']['ui_show_performance_statistics'] = array( '#type' => 'checkbox', '#title' => t('Show performance statistics'), - '#default_value' => $this->config->get('ui.show.performance_statistics'), + '#default_value' => $config->get('ui.show.performance_statistics'), ); $form['live_preview']['options']['ui_show_additional_queries'] = array( '#type' => 'checkbox', '#title' => t('Show other queries run during render during live preview'), '#description' => t("Drupal has the potential to run many queries while a view is being rendered. Checking this box will display every query run during view render as part of the live preview."), - '#default_value' => $this->config->get('ui.show.additional_queries'), + '#default_value' => $config->get('ui.show.additional_queries'), ); return $form; @@ -124,7 +127,7 @@ public function buildForm(array $form, array &$form_state) { * Implements \Drupal\Core\Form\FormInterface::submitForm(). */ public function submitForm(array &$form, array &$form_state) { - $this->config + $this->configFactory->get('views.settings') ->set('ui.show.master_display', $form_state['values']['ui_show_master_display']) ->set('ui.show.advanced_column', $form_state['values']['ui_show_advanced_column']) ->set('ui.show.display_embed', $form_state['values']['ui_show_display_embed']) diff --git a/core/modules/views/views_ui/lib/Drupal/views_ui/Form/BreakLockForm.php b/core/modules/views/views_ui/lib/Drupal/views_ui/Form/BreakLockForm.php index d7f6d53..cc699b8 100644 --- a/core/modules/views/views_ui/lib/Drupal/views_ui/Form/BreakLockForm.php +++ b/core/modules/views/views_ui/lib/Drupal/views_ui/Form/BreakLockForm.php @@ -58,19 +58,6 @@ public static function create(ContainerInterface $container) { } /** - * Creates a new instance of this form. - * - * @param \Drupal\views\ViewStorageInterface $view - * The view being acted upon. - * - * @return array - * The built form array. - */ - public function getForm(ViewStorageInterface $view) { - return drupal_get_form($this, $view); - } - - /** * Implements \Drupal\Core\Form\FormInterface::getFormID(). */ public function getFormID() { diff --git a/core/modules/views/views_ui/lib/Drupal/views_ui/Form/DeleteForm.php b/core/modules/views/views_ui/lib/Drupal/views_ui/Form/DeleteForm.php index 3f38679..f9b7272 100644 --- a/core/modules/views/views_ui/lib/Drupal/views_ui/Form/DeleteForm.php +++ b/core/modules/views/views_ui/lib/Drupal/views_ui/Form/DeleteForm.php @@ -16,19 +16,6 @@ class DeleteForm implements FormInterface { /** - * Creates a new instance of this form. - * - * @param \Drupal\views\ViewStorageInterface $view - * The view being acted upon. - * - * @return array - * The built form array. - */ - public function getForm(ViewStorageInterface $view) { - return drupal_get_form($this, $view); - } - - /** * Implements \Drupal\Core\Form\FormInterface::getFormID(). */ public function getFormID() { diff --git a/core/modules/views/views_ui/lib/Drupal/views_ui/Form/SettingsFormBase.php b/core/modules/views/views_ui/lib/Drupal/views_ui/Form/SettingsFormBase.php deleted file mode 100644 index 82ea585..0000000 --- a/core/modules/views/views_ui/lib/Drupal/views_ui/Form/SettingsFormBase.php +++ /dev/null @@ -1,57 +0,0 @@ -config = $config_factory->get('views.settings'); - } - - /** - * Implements \Drupal\Core\ControllerInterface::create(). - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('config.factory') - ); - } - - /** - * Creates a new instance of this form. - * - * @return array - * The built form array. - */ - public function getForm() { - return drupal_get_form($this); - } - -} diff --git a/core/modules/views/views_ui/views_ui.routing.yml b/core/modules/views/views_ui/views_ui.routing.yml index ed81159..9c64891 100644 --- a/core/modules/views/views_ui/views_ui.routing.yml +++ b/core/modules/views/views_ui/views_ui.routing.yml @@ -15,14 +15,14 @@ views_ui.add: views_ui.settings.basic: pattern: '/admin/structure/views/settings' defaults: - _controller: '\Drupal\views_ui\Form\BasicSettingsForm::getForm' + _form: '\Drupal\views_ui\Form\BasicSettingsForm' requirements: _permission: 'administer views' views_ui.settings.advanced: pattern: '/admin/structure/views/settings/advanced' defaults: - _controller: '\Drupal\views_ui\Form\AdvancedSettingsForm::getForm' + _form: '\Drupal\views_ui\Form\AdvancedSettingsForm' requirements: _permission: 'administer views' @@ -58,7 +58,7 @@ views_ui.clone: views_ui.delete: pattern: '/admin/structure/views/view/{view}/delete' defaults: - _controller: 'Drupal\views_ui\Form\DeleteForm::getForm' + _form: 'Drupal\views_ui\Form\DeleteForm' requirements: _permission: 'administer views' @@ -104,7 +104,7 @@ views_ui.preview: views_ui.breakLock: pattern: '/admin/structure/views/view/{view}/break-lock' defaults: - _controller: '\Drupal\views_ui\Form\BreakLockForm::getForm' + _form: '\Drupal\views_ui\Form\BreakLockForm' display_id: NULL requirements: _permission: 'administer views'