- π¨π¦Canada yang_yi_cn
FYI I just comment out the line
... // 'type' => MENU_CALLBACK, ...
and the
drush dmu:upgrade
can continue to run. Even generated the routing, links, controller, form files. (not 100% correctly, but did most of the work).If you looking at the source code (in HookMenu.php), it's trying run a
eval(...);
on the you module's D7 hook_menu(), i.e.
eval("my_module_menu() { ... }");
which provides the function in PHP runtime, then called later in a call_user_func()... to get the returned values ($items), then parse the items to generate D8 code.
In other words, as long as you can somehow return the array, the details in the array doesn't need to be 100%. Also I believe the D7 concept of MENU_LOCAL_TASK, MENU_CALLBACK are deprecated anyway.
MENU_CALLBACK is just a routing with no links.
MENU_TASK / MENU_LOCAL_TASK are routings + menu links, but there's no "LOCAL TASK" anymore.So just comment out the type seems to be a reasonable solution.
- ππΊHungary GΓ‘bor Hojtsy Hungary
Local tasks, etc. are separetely defined in Drupal 8+. If you comment out the constants, they will not be taken into account. Which PHP version are you using?
- Status changed to Postponed: needs info
about 2 years ago 12:13pm 29 March 2023 - π¬π§United Kingdom malcolmp
I get the same issue:
PHP 8.1.2-1ubuntu2.14 (cli) (built: Aug 18 2023 11:41:11) (NTS)
Drupal version : 9.5.11
Drush version : 11.0.0 - Status changed to Active
5 months ago 2:34am 28 November 2024 - πΊπΈUnited States mlncn Minneapolis, MN, USA
With PHP 8.3.12 i am getting:
Error: Undefined constant "MENU_CALLBACK" in /var/www/html/web/modules/contrib/drupalmoduleupgrader/src/Routing/HookMenu.php(73) : eval()'d code on line 24 #0 [internal function]: ark_menu() #1 /var/www/html/web/modules/contrib/drupalmoduleupgrader/src/Routing/HookMenu.php(87): call_user_func() #2 /var/www/html/web/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Converter/Routing.php(70): Drupal\drupalmoduleupgrader\Routing\HookMenu->getSourceRoutes() #3 /var/www/html/web/modules/contrib/drupalmoduleupgrader/src/Commands/DrupalmoduleupgraderCommands.php(188): Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Routing->convert() #4 [internal function]: Drupal\drupalmoduleupgrader\Commands\DrupalmoduleupgraderCommands->upgrade() #5 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array() #6 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() #7 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() #8 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process() #9 /var/www/html/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute() #10 /var/www/html/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run() #11 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand() #12 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun() #13 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run() #14 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun() #15 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run() #16 /var/www/html/vendor/drush/drush/drush(4): require('...') #17 /var/www/html/vendor/bin/drush(119): include('...')
(And i still get the same error if i throw
define('MENU_CALLBACK', 0x0);
into the module i'm trying to upgrade.)