Closed (fixed)
Project:
Config Pages
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
29 Aug 2016 at 10:54 UTC
Updated:
29 Nov 2017 at 14:16 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
shumer commentedComment #3
icurk commentedHere is a patch, which creates menu links.
Comment #4
boshtian commentedI confirm that this patch works for me.
Comment #5
boshtian commentedComment #7
shumer commentedThx for this patch, already committed to dev version, so will be available with new release.
Comment #8
rodrigoaguileraI found a little nitpick for this feature.
If I set the path to
/admin/config/system/general_configuration
Everything is OK
But /admin/config/system/general-configuration
fails to create the link.
Can we address this here?
Comment #9
rodrigoaguileraI think I was confused by my debugging sorry.
what made the link disappear is using "drush cr". Does not matter if the path contains "_" or "-".
I think using hook_menu_links_discovered_alter to add new links is a bit weird. I think the implmentation of this functionality should be closer to what views does starting with the MODULE_NAME.links.menu.yml
Also using t($variable) should be fixed.
Comment #10
icurk commentedStrange... The issue is not with how the link is created, it has to do it with how you clear cache. If you run drush cr, then hook_menu_links_discovered_alter is not called, hence menu link is not created. But if you clear cache inside an administration, then this hook is called and menu link is created.
hook_menu_links_discovered_alter is the right way to do it, as this is one of the options written in drupal documentation "How to add dynamic menu links". And the other one is, as you said, with using deriver class in *.links.menu.yml file. I tested both options, but if you rebuild cache with drush menu links are not created.
Comment #11
rodrigoaguileraYou mean that you tried a deriver class and suffers from the same problem?
I tried to reproduce this with the menu links that views creates and I was no able to reproduce it so clearly config pages does something different.
Thanks for taking the time to look at it :)
Comment #13
grimreaperHello,
I have the same problem. The menu links are not created. The parent is not detected.
I confirm that when using drush cr, the hook_menu_links_discovered_alter is triggered
On the line:
When in the execution of "drush cr", no route is found, but when executing using devel/php, it founds the right route.
Comment #14
rodrigoaguileraI still feel is a problem with drush so if anyone can produce a test case for them to help fix this bug that would be great
https://github.com/drush-ops/drush/issues/2683#issuecomment-311626273
Comment #15
shumer commentedI can't reproduce this issue in my local environment. @Grimreaper or @rodrigoaguilera anyone of you still able to reproduce it? If so, please share STR with me. Thx.
Comment #16
shumer commentedComment #17
shumer commentedComment #19
shumer commentedFixed.
Comment #21
flocondetoileI found a bug related to this commit.
If you create a custom path, let's say
/admin/config/cerema/activites, for a config page, then if you flush routing and links cache (with the custom link provided by admin_toolbar_tools), you've got a fatal error.Because the parent
/admin/config/cerema/do not correspond to any existing routes.As a workaround I added a custom route which correspond to the parent path.
Should we reopen this issue or create a new one ?
Comment #22
icurk commentedI think that it would be better to create a new issue.
Comment #23
rodrigoaguileraJust FYI I do not suffer from the drush cr bug anymore with config pages 2.1 and drush 9