It seems that "legacy" menu callbacks are gone as for this change notice: https://drupal.org/node/2106709 and we need to adapt all Devel ones (menu/reinstall, list fields, etc etc) so they use controllers.

In case of forms we need to extend FormBase & for the arbitrary pages, ControllerBase

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pcambra’s picture

Assigned: Unassigned » pcambra

progressing on this, let's see how much can I get done today

pcambra’s picture

Status: Active » Needs work
FileSize
6.87 KB

Also our devel menu block is gone and "menu_name" in hook_menu has no effect for blocks now. Need to look into it.
Attaching the progress so far.

amateescu’s picture

Here's a review for the current work:

  1. +++ b/devel.module
    @@ -140,11 +137,8 @@ function devel_menu() {
       $items['devel/php'] = array(
         'title' => 'Execute PHP Code',
    

    You can omit the title here and set it in the $form array with $form['#title'].

  2. +++ b/devel.routing.yml
    @@ -1,6 +1,21 @@
    +  path: 'devel/php'
    ...
    +  path: 'devel/cache/clear'
    

    Paths should have a leading '/'. I know it's stupid, but that's the "rule" :(

  3. +++ b/lib/Drupal/devel/Controller/DevelController.php
    @@ -0,0 +1,27 @@
    +
    +
    

    Extra empty line.

  4. +++ b/lib/Drupal/devel/Controller/DevelController.php
    @@ -0,0 +1,27 @@
    +  }
    +}
    

    Missing empty line :)

joelpittet’s picture

@pcambra Are there plans to do the other components in here too or are those going to be on separate issues?

pcambra’s picture

@pcambra Are there plans to do the other components in here too or are those going to be on separate issues?

My plan was everything here, feel free to jump in :)

joelpittet’s picture

#2092529: [meta] Improve DX for defining custom routes this can cause some issues with if (module_exists('taxonomy')) {} in function devel_generate_menu() {

joelpittet’s picture

Status: Needs work » Needs review
FileSize
4.85 KB
2.56 KB

it's acctually this one:
#2091411: Provide an easier mechanism for a route definition wrapped by module_exists()

Here's more on that patch above, hope that helps a bit... not tested

joelpittet’s picture

FileSize
34.58 KB
29.65 KB

ha whoops, xposted that. oh and did the nitpickery in #3 ;)

pcambra’s picture

Status: Needs review » Needs work

Oh sorry, didn't realise that you meant devel generate with "other components", could you please move the devel generate patch to another issue?

It's a little too much for this one :\

wodzik’s picture

I've been working on this and here is my patch

wodzik’s picture

Sorry. This patch is correct.

pcambra’s picture

could you please move the devel generate patch to another issue? It's a little too much for this one :\

wodzik’s picture

there are only devel routes and callbacks to it

joelpittet’s picture

Moved devel_generate to this one #2113659: Routing YAML for devel_generate

joelpittet’s picture

@wodzik could do an interdiff between your changes and @pcambra patch in #2?

That way we can see what you changed?

joelpittet’s picture

FileSize
55.47 KB

Here's the interdiff between #2 and #11.

pcambra’s picture

Not sure what's the origin of all those tabs but please whoever got them in, check the coding standards and IDE settings.

Here's a patch to recover a little sanity, thanks for the work here @joelpittet & @wodzik

We've got a couple more to do (query log and user switch, seems) and I'll open a followup to recover the menu block with this stuff that got lost somewhere between https://drupal.org/node/2106709 and "menu_name" key in hook_menu()

pcambra’s picture

And here we go, more WIP, devel switch conversion was a tough one.

Only these to go:

  • devel/explain
  • devel/arguments
  • devel/run-cron
joelpittet’s picture

+++ b/devel.module
@@ -42,166 +43,95 @@ function devel_menu() {
-    'title' => 'Clear cache',
...
-    'title' => 'Function reference',
...
-    'title' => 'Reinstall modules',
...
etc

I could be wrong but I was under the impression that the hook_menu needs the 'title' for the Menu Item titles?

pcambra’s picture

I could be wrong but I was under the impression that the hook_menu needs the 'title' for the Menu Item titles?

I was thinking the same thing, but we've got _title in the routes in the yml file and @amateescu mentioned this in #3

You can omit the title here and set it in the $form array with $form['#title'].

So I guess 'title' is unwanted in hook_menu for some reason... I'll test it further before pushing to be really sure.

joelpittet’s picture

You can omit the title here and set it in the $form array with $form['#title'].

The only time you would remove 'title' from hook_menu items would be if it says type=>MENU_CALLBACK. And in that case you wouldn't need the item at all. I'm positive @amateescu is mistaken on that point.

#2047633: Move definition of menu links to hook_menu_link_defaults(), decouple key name from path, and make 'parent' explicit

joelpittet’s picture

Status: Needs work » Needs review
FileSize
5.67 KB
66.28 KB

Some fixes and cleanup, added titles back in, fixed a couple route names, added title args back in. Removed menu items that were only MENU_CALLBACKs and fixed a couple typos/mistakes (menu_name was a route_name and one route had the wrong name in the menu item.

amateescu’s picture

Yep, I didn't take into consideration that the 'devel/php' menu item was actually supposed to show up in a menu. I see now that that's the case, so 'title' needs to be kept in the menu link definition.

joelpittet’s picture

Thanks @amateescu for confirming:)

+++ b/devel.routing.yml
@@ -1,6 +1,215 @@
+  path: 'devel/menu/reset'

Missing start path

tim.plunkett’s picture

FileSize
31.46 KB
68.35 KB

Fixed #24, and cleaned up in general.

pcambra’s picture

Issue summary: View changes
Status: Needs review » Fixed
FileSize
10.78 KB
75.43 KB

Seems this got in #2048223: Add $account argument to AccessCheckInterface::access() method and use the current_user service so I changed that part.

Also #2013533: Replace hook_init by an event subscriber was needed to fix this one.

Not very fond of pushing unrelated changes in here, but we needed the clean up anyways... Pushed this to 8.x-1.x (final patch and interdiff attached)

Thanks @joelpittet @amateescu @tim.plunkett

salvis’s picture

Thanks all for this tough piece of work!

It would be nice to get a green patch before pushing though (if possible).

pcambra’s picture

Yeah we had all sort of problems with the testbot (see #2127283: Fix the tests (again)) and this got in a couple of days ago, now we're back in green and hopefully we won't need to rewrite more big chunks of code to keep the pace of HEAD.

Status: Fixed » Closed (fixed)

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