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
I've added various fields to my menu. Some text, some links, some paragraphs. Save and clear cache. The menu items show up, but none of the added fields.
Steps to reproduce
Add fields. Clear Cache. Refresh page, no added fields.
I've tried switching themes to use Core themes. I've turned on the Demos module and the Body and Term fields it uses, show up. But no new fields I add are rendered.
Comment | File | Size | Author |
---|---|---|---|
#2 | Screenshot 2020-09-01 at 4.01.25 PM.png | 27.19 KB | munish.kumar |
#2 | Screenshot 2020-09-01 at 4.02.18 PM.png | 218.77 KB | munish.kumar |
Issue fork menu_item_extras-3168381
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
Comment #2
munish.kumar CreditAttribution: munish.kumar as a volunteer and at Material for Drupal India Association commentedHi @StevenPatz,
I have tried to reproduce this issue with one of the drupal core theme, but not able to reproduce. I have added some custom fields to menu and add some data. Menu item will render properly with custom fields data. I have added the screenshot in which I have added the custom link field in the menu item and add some link in it. The custom link also render with the menu item.
Thanks,
Munish
Comment #3
munish.kumar CreditAttribution: munish.kumar as a volunteer and at Material for Drupal India Association commentedComment #4
StevenPatzLooking for some additional help. if I use a theme such as bartik, I can add and see extra fields like you'd expect. But with our custom theme, even with all .theme preprocess hooks disabled, all I can get displayed is the actual menu items. There doesn't seem to be any CSS hiding anything, as the HTML just doesn't have anything in it. Example my theme:
Example bartik:
The img tag in the second example is one of the extra fields. What could be stopping the module from actually generating and populating variables for the theme to display? The Demo seems to work fine in bartik, terms, images, body fields all show up. None of these do in our custom theme.
Comment #5
StevenPatzAs a further followup. If I place some HTML comments into menu-link-content.html.twig and menu-levels.html in the contrib templates directory, I see those comments on Bartik, but none of the comments in my custom theme. It seems the twig isn't getting loaded in the custom, but I can't track down why that would be. Any ideas, appreciated.
Comment #6
fmitchell CreditAttribution: fmitchell commentedI'm also experiencing the same issue on a custom theme. Switching to Bartik renders the menu items fine. @StevenPatz, were you able to figure out anything?
Comment #7
StevenPatzUnfortunately, no. We had to find another module to replicate what we wanted to do with this module.
Comment #8
volegerBlocked by the core issue. See #2915792: MenuLinkContentAccessControlHandler does not allow "view" access without admin permission, making these entities inaccessible via REST, JSON API and GraphQL and entity reference fields
Comment #9
FatherShawnInstalled in a fresh D10.1 site, I do not see the added fields in Olivero but switching to Stark and they render. Looking deeper, Stark uses
menu--extras.html.twig
but Olivero is choosingmenu--primary-menu.html.twig
which I'm sure is a theme template taking priority over a module template.