Closed (won't fix)
Project:
Drupal core
Version:
11.x-dev
Component:
menu system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
16 Jul 2014 at 08:06 UTC
Updated:
15 Jul 2025 at 19:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
sunComment #2
sunComment #3
effulgentsia commentedFYI: #2301317: MenuLinkNG part4: Conversion changes hook_menu_link_defaults_alter() to hook_menu_links_discovered_alter(). Actually, that latter name is already in HEAD in MenuLinkManager::getDefinitions(), but MenuLinkManager isn't used by core until that issue lands. Changes to that name still possible of course.
Comment #4
dawehnerI would be fine with hook_links_task_discovered_alter, hook_links_action_discovered_alter and hook_links_contextual_discovered_alter
Comment #5
sunNot sure why we're moving away from "info", but "discovered" sounds just weird. Either "info" or "definitions"; e.g.:
hook_links_task_info_alter()
hook_links_task_definitions_alter()
Whether "definitions" is correct and not misleading mainly depends on the point in time the hook is invoked; if the alter hook manipulates the raw definitions right after reading them from .yml files, then "definitions" would be correct. However, if the definitions have been preprocessed in any way prior to the alter hook invocation already, then "definitions" is no longer accurate, whereas "info" would be.
Comment #6
effulgentsia commented"discovered" was added to the menu links one, because MenuLinkManager has an addDefinition() method as well. In other words, some menu links are discovered, and only those are altered, and others (custom links) are pushed into MenuLinkManager (with no alter hook at the plugin level, since code has an opportunity to act at the entity level) rather than discovered from it. We don't have this dual pull/push model for any of our other links, or for any other plugin manager in core (pwolanin mentioned we might have one other one in core with a similar pattern, but I can't find it). Note that custom blocks follow a pull model via derivatives, but that isn't scalable, so if we're concerned about supporting sites with thousands of custom blocks, we may want to consider applying the pull/push hybrid there as well.
Comment #7
dawehnerThere is an issue targeting that problem in a generic way: #2312383: Provide a plugin manager interface which allows to add new definitions/update some/remove some Maybe you have some ideas but yeah I think adding and removing definitions
also has to be take into account for the UI, as that many custom blocks would not scale there as well.
Comment #8
cilefen commentedTrying hook_menu_local_tasks_alter() to hook_links_task_discovered_alter().
Comment #9
cilefen commentedHere it is, with info_alter() instead of discovered_alter().
Comment #10
xjmThis issue was marked as a beta target for the 8.0.x beta, but is not applicable as an 8.1.x beta target, so untagging.
I've moved the issue to 8.2.x since it could be possible to implement this with BC in a minor.
Comment #11
dawehnerObviously we can't just change this now. I'm wondering whether we could leverage the type as array functionality of
\Drupal\Core\Extension\ModuleHandler::alter,to provide some BC compatible way. Changing just the documentation as the patch does, doesn't really help, this is quite sure
Comment #26
smustgrave commentedThank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #27
berdirI think it's fine to close this. It technically still makes sense and we now do have the means to deprecate and introduce new hooks, but we've had those hook names for 10 years now and it doesn't seem worth the trouble of doing the whole BC dance for a better hook name.
Comment #28
xjmSaving some additional credits for reviewers and maintainer triage.