Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Once #2301239: MenuLinkNG part1 (no UI or conversions): plugins (static + MenuLinkContent) + MenuLinkManager + MenuTreeStorage is in, it would be possible to no longer hardcode the maximum depth of menus: MenuTreeStorage::MAX_DEPTH
Proposed resolution
- Generate the schema using a configured maximum length
- Try to not allow lowering the size
Remaining tasks
User interface changes
API changes
Postponed until
Comment | File | Size | Author |
---|---|---|---|
#25 | fix-max-depth-menu-tree.patch | 4.83 KB | jnicola |
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentednot sure the idea here - we could make it a constructor param, but that could cause problems if the table already exists.
Or, we could just make sure we e.g. loop over the depth instead of hard-coding any uses of p1 .. p9 in the schema function and other code?
Comment #2
xjmComment #3
mgiffordunblocked.
Comment #7
mstrelan CreditAttribution: mstrelan commentedComment #11
wombatbuddy CreditAttribution: wombatbuddy commentedJust in case, if someone needs a menu with unlimited depth, than you can use 'Hierarchical Taxonomy Menu' module.
Comment #12
DYdave CreditAttribution: DYdave as a volunteer commentedHi guys,
Is this still supposed to happen at any point?
Issue was set "active" at #3, 5 years ago and hasn't changed since.
Should it be set to "Postponed" again?
Should its version also be updated? Perhaps to 9.0.x-dev?
Thanks in advance for any update.
Cheers!
Comment #13
apadernoComment #14
Nick Hope CreditAttribution: Nick Hope as a volunteer commented"Just in case, if someone needs a menu with unlimited depth, than you can use 'Hierarchical Taxonomy Menu' module."
Unfortunately it's not unlimited. it cannot show more than 10 sub-levels. I really need about 15 for a full tree of living things.
Comment #15
wombatbuddy CreditAttribution: wombatbuddy commented@Nick Hope,
it can be easily fixed by editing 'HierarchicalTaxonomyMenuBlock.php' file.
I have crated the path for #3063209.
Comment #19
jnicola CreditAttribution: jnicola commentedRan into this problem on a monolithic menu setup that we have. One sub groups menus finally crested 10 depth and it all went to heck!
I'm writing a patch right now that will increase depth to 10. We'll see how it actually goes. Not sure how configurable we can make this since menu depth is all stored in separate columns versus one column containing all parent information and depth (p1, p2, p3... etc etc p9). This would be something worth looking at when overhauling menu in Drupal core going forward. From what I can tell this is actually leftover from some choices in Drupal 6!
Comment #22
jrwest_webguy CreditAttribution: jrwest_webguy as a volunteer commented@jnicola -- Any progress on a patch to increase to 10?
Adding a menu-via-taxonomy module does not address the shortcomings of the Core Drupal menu system. Also, as far as I can tell, migrating from a node-based menu to a taxonomy-based menu is a tremendous undertaking. It's 2022, web servers are bigger, stronger, and faster than what they were 14 years ago. The menu depth should be configurable, ideally per menu, imho.
Comment #24
jbaum_13 CreditAttribution: jbaum_13 commentedI am in need of this capabiltiy. Currently I am unable to add nodes to the menu in the desired location since it is not showing me all of the children. The options change from node to node depending upon the depth of the children for that node.
For ex. one page node I try to add to the menu and I can see the full menu:
Full menu
Then I will access another node and try to add it to the menu and it only shows one level:
Limited Menu
We have a large site with lots of Academic content that is past the max depth of 9. Any recommendations on how to change the max depth would be much appreciated.
Comment #25
jnicola CreditAttribution: jnicola commented@jbaum_13 --> Not sure what combination of modules you are using, but we've got a lot of experience with crazy menus here at OHSU if you ever want to talk architecture that helps handle all of that!
We've had plenty of mistakes to learn from and a decent amount of success that might work for you as well :) Feel free to reach out if you want.
For a patch that someone asked for a while ago and I missed, here's what we wrote and are utilizing at OHSU as part of what we're up to. It's definitely not ready to be utilized into care as is and hasn't been tested beyond our very specific monolithic menu approach (which we're moving away from) so no guarantees this has any value at all, infact it may make things worse so implement at your own risk, haha.
Comment #26
jbaum_13 CreditAttribution: jbaum_13 commented@jnicola thank you so much for your quick response! I tried the patch as is and got the following error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'p10' in 'order clau
se': SELECT "menu_tree".*
FROM
"menu_tree" "menu_tree"
WHERE ("menu_name" = :db_condition_placeholder_0) AND ("depth" <= :db_condi
tion_placeholder_1) AND ("enabled" = :db_condition_placeholder_2)
ORDER BY "p1" ASC, "p2" ASC, "p3" ASC, "p4" ASC, "p5" ASC, "p6" ASC, "p7" A
SC, "p8" ASC, "p9" ASC, "p10" ASC, "p11" ASC, "p12" ASC, "p13" ASC, "p14" A
SC, "p15" ASC, "p16" ASC, "p17" ASC, "p18" ASC, "p19" ASC, "p20" ASC; Array
(
[:db_condition_placeholder_0] => main-menu
[:db_condition_placeholder_1] => 1
[:db_condition_placeholder_2] => 1
)
Thank you so much for your help! I greatly appreciate it!