Problem/Motivation

Happens only in specific circumstances. In my case, I can only reproduce it when the site is using openeuropa/oe_multilingual module. In that case, when I enable modal_page module, the following error is displayed:

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "modal_page.settings" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 211 of core/lib/Drupal/Core/Routing/RouteProvider.php).

Not sure what is the definite reason in this case, however, core's documentation for hook_install() is advising to use hook_modules_installed() when route information is required:

If the module provides a MODULE.routing.yml or alters routing information these changes will not be available when this hook is fired. If up-to-date router information is required, for example to use \Drupal\Core\Url, then (preferably) use hook_modules_installed() or rebuild the router in the hook_install() implementation.

Steps to reproduce

Tested on Drupal 10.5 and 11.2.
1. Enable openeuropa/oe_multilingual
2. Enable modal_page (the error is displayed both when using drush en modal_page or when using admin UI.

Proposed resolution

Use hook_modules_installed() to display the message.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#7 3543767-7.patch1.03 KBkeszthelyi

Issue fork modal_page-3543767

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

keszthelyi created an issue. See original summary.

keszthelyi’s picture

Assigned: keszthelyi » Unassigned
Status: Active » Needs review
renatog’s picture

Hey @keszthelyi , nice catch!

Thanks a lot for reporting and providing a solution for this

I'm reviewing the MR

renatog’s picture

Status: Needs review » Needs work

Added a suggestion in the MR

keszthelyi’s picture

Status: Needs work » Needs review
keszthelyi’s picture

StatusFileSize
new1.03 KB

Uploading a patch file for the current MR state (our CI requires static patch files to be used).

renatog’s picture

Status: Needs review » Needs work
renatog’s picture

Status: Needs work » Needs review

PR updated

  • Cut the modal_page_modules_installed from .install
  • Moved to the .module

P.S. This is just to follow the guidelines that asks that however it was working fine on .install, and honestly in the first time looking seems better to be there

Just a guess, but Maybe the reason why should be declared on is because you can implement this hook to "intercept" even when other modules has been installed, while .install seems to be related only to own installation

I'm not really sure about the reason, However it's definitely a valid fix and I'm going to merge that

Thank you so much @keszthelyi

  • renatog committed f9b88fcc on 6.0.x authored by keszthelyi
    Issue #3543767: Use hook_modules_installed() to display installation...
renatog’s picture

Status: Needs review » Fixed

Released https://www.drupal.org/project/modal_page/releases/6.0.0-beta10

Thank you so much for your help with really nice contributions @keszthelyi

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

keszthelyi’s picture

@renatog re move to .module: indeed, didn't notice, nice catch, thanks for fixing it!

renatog’s picture

My pleasure

  • 18d2335b committed on 5.1.x
    feat: #3543767 RouteNotFoundException thrown during module install
    
    By:...

  • 0d09ce17 committed on 5.0.x
    feat: #3543767 RouteNotFoundException thrown during module install
    
    By:...

Status: Fixed » Closed (fixed)

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