Convert the form builder "views_test_data_element_form" to a new-style Controller, using the instructions in the WSCCI Conversion Guide.

@see views_test_data_menu() in core/modules/views/tests/views_test_data/views_test_data.module

Files: 
CommentFileSizeAuthor
#5 controller-1979034-5.patch2.97 KBplopesc
PASSED: [[SimpleTest]]: [MySQL] 55,436 pass(es). View
#5 interdiff.txt844 bytesplopesc
#3 controller-1979034-3.patch2.79 KBplopesc
PASSED: [[SimpleTest]]: [MySQL] 55,860 pass(es). View
#3 interdiff.txt1.97 KBplopesc
#1 controller-1979034-1.patch3.24 KBplopesc
PASSED: [[SimpleTest]]: [MySQL] 55,417 pass(es). View

Comments

plopesc’s picture

Status: Active » Needs review
FileSize
3.24 KB
PASSED: [[SimpleTest]]: [MySQL] 55,417 pass(es). View

Hello

Attaching patch that converts views_test_data_element_form() to a Controller.

Regards.

dawehner’s picture

+++ b/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Form/ViewsTestDataElementForm.phpundefined
@@ -0,0 +1,57 @@
+ * Contains \Drupal\views_test_data\ViewsTestDataElementForm.

This documentation does not match with the namespace.

+++ b/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Form/ViewsTestDataElementForm.phpundefined
@@ -0,0 +1,57 @@
+class ViewsTestDataElementForm implements FormInterface, ControllerInterface {
...
+  public static function create(ContainerInterface $container) {
+    return new static();
+  }

Should we implement the ControllerInterface if nothing is injected?

+++ b/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Form/ViewsTestDataElementForm.phpundefined
@@ -0,0 +1,57 @@
+  /**
+   * Implements \Drupal\Core\ControllerInterface::create().
+   */
...
+  /**
+   * Implements \Drupal\Core\Form\FormInterface::getFormID().
+   */
...
+  /**
+   * Implements \Drupal\Core\Form\FormInterface::buildForm().
+   */
...
+  /**
+   * Implements \Drupal\Core\Form\FormInterface::validateForm().
+   */
...
+  /**
+   * Implements \Drupal\Core\Form\FormInterface::submitForm().
+   */

These lines could all just use {@inheritdoc}

+++ b/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Form/ViewsTestDataElementForm.phpundefined
@@ -0,0 +1,57 @@
+  }

Missing empty line.

plopesc’s picture

Assigned: Unassigned » plopesc
FileSize
1.97 KB
2.79 KB
PASSED: [[SimpleTest]]: [MySQL] 55,860 pass(es). View

Re-rolling patch following @dawehner advices.

Regards.

dawehner’s picture

+++ b/core/modules/views/tests/views_test_data/views_test_data.moduleundefined
@@ -139,24 +139,8 @@ function views_test_data_menu() {
   $items['views_test_data_element_form'] = array(
     'title' => 'Views test data element form',
     'description' => 'Views test data element form callback',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('views_test_data_element_form'),
-    'access callback' => TRUE,
+    'route_name' => 'views_test_data_element',
   );

I wouldn't be 100% sure, but have you tried to remove the hook_menu as well? I don't think that the menu link is used.

The test you need to run is "'View element'" in the "Views" group.

plopesc’s picture

FileSize
844 bytes
2.97 KB
PASSED: [[SimpleTest]]: [MySQL] 55,436 pass(es). View

I didn't remove the hook_menu implementation because it was previously a menu item instead of a menu callback. I just only converted form page to Controler.

I've removed the entire hook_menu implementation and views module tests still working in my local environment. Then, re-rolling patch as menu callback.

Regards.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Nice!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed bb2cdb2 and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.