Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#6 | controller-1978974-6.patch | 3.37 KB | plopesc |
#4 | controller-1978974-4.patch | 3.29 KB | plopesc |
#4 | interdiff.txt | 2.48 KB | plopesc |
#1 | controller-1978974-1.patch | 2.77 KB | plopesc |
Comments
Comment #1
plopescHello
Attaching patch that converts shortcut_set_admin() to a Controller.
Regards.
Comment #2
dawehnerI really love to see all these route conversions going on!
One thing you could do is to inject the entity plugin manager into the controller. ('plugin.manager.entity') which has the getListController() method.
Comment #3
plopescOf course!
Comment #4
plopescRe-rolling patch with dependency injection.
Regards.
Comment #5
dawehnerThanks for fixing these points. Just think of a world where you can unit test all this code!
I looked for some examples and it always has been "the entity manager".
Sorry for the nitpick. Afaik the standard is "Constructs a $name object." ... You also create a shortcut controller here, not a viewsUI Controller :)
Yeah PHP is odd from time to time. It allows you to call a method with wrong casing. The method is called getListController
Comment #6
plopescThanks for your hard review.
Re-rolling again.
Regards.
Comment #7
dawehnerThanks for your patience.
Comment #8
alexpottCommitted b5b34b1 and pushed to 8.x. Thanks!