Part of #1971384: [META] Convert page callbacks to controllers

For instructions on how to convert a page callback into a controller, see the WSCCI Conversion Guide.

Files: 
CommentFileSizeAuthor
#6 controller-1978974-6.patch3.37 KBplopesc
PASSED: [[SimpleTest]]: [MySQL] 55,835 pass(es).
[ View ]
#4 controller-1978974-4.patch3.29 KBplopesc
PASSED: [[SimpleTest]]: [MySQL] 55,534 pass(es).
[ View ]
#4 interdiff.txt2.48 KBplopesc
#1 controller-1978974-1.patch2.77 KBplopesc
PASSED: [[SimpleTest]]: [MySQL] 55,646 pass(es).
[ View ]

Comments

Assigned:Unassigned» plopesc
Status:Active» Needs review
StatusFileSize
new2.77 KB
PASSED: [[SimpleTest]]: [MySQL] 55,646 pass(es).
[ View ]

Hello

Attaching patch that converts shortcut_set_admin() to a Controller.

Regards.

I really love to see all these route conversions going on!

+++ b/core/modules/shortcut/lib/Drupal/shortcut/Controller/ShortcutController.phpundefined
@@ -0,0 +1,30 @@
+    return entity_list_controller('shortcut')->render();

One thing you could do is to inject the entity plugin manager into the controller. ('plugin.manager.entity') which has the getListController() method.

Of course!

StatusFileSize
new2.48 KB
new3.29 KB
PASSED: [[SimpleTest]]: [MySQL] 55,534 pass(es).
[ View ]

Re-rolling patch with dependency injection.

Regards.

Thanks for fixing these points. Just think of a world where you can unit test all this code!

+++ b/core/modules/shortcut/lib/Drupal/shortcut/Controller/ShortcutController.phpundefined
@@ -0,0 +1,48 @@
+   * Stores the Entity manager.
...
+   *   The Entity manager.

I looked for some examples and it always has been "the entity manager".

+++ b/core/modules/shortcut/lib/Drupal/shortcut/Controller/ShortcutController.phpundefined
@@ -0,0 +1,48 @@
+   * Constructs a new \Drupal\views_ui\Routing\ViewsUIController object.

Sorry for the nitpick. Afaik the standard is "Constructs a $name object." ... You also create a shortcut controller here, not a viewsUI Controller :)

+++ b/core/modules/shortcut/lib/Drupal/shortcut/Controller/ShortcutController.phpundefined
@@ -0,0 +1,48 @@
+    return $this->entityManager->getListcontroller('shortcut')->render();

Yeah PHP is odd from time to time. It allows you to call a method with wrong casing. The method is called getListController

StatusFileSize
new3.37 KB
PASSED: [[SimpleTest]]: [MySQL] 55,835 pass(es).
[ View ]

Thanks for your hard review.

Re-rolling again.

Regards.

Status:Needs review» Reviewed & tested by the community

Thanks for your patience.

Status:Reviewed & tested by the community» Fixed

Committed b5b34b1 and pushed to 8.x. Thanks!

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