- Issue created by @medinasod
This is the expected behavior when something renders an inaccessible link. Are you absolutely sure the site has no menu-related contributed modules, no custom code rendering menu links, and no related patches applied?
You mentioned not knowing how to debug this. Here's how:
- Setup and start a PHP debugger.
- Put a breakpoint in Drupal\Core\Menu\InaccessibleMenuLink::getTitle().
- When execution stops at the breakpoint, observe the call stack.
P.S. Drupal 9 reached end-of-life last year and is no longer supported.
- πΊπΈUnited States medinasod
Thanks for your help, @cilefen. There aren't any menu-related contrib modules, but there is a ton of custom code (it's a site I inherited). There is a menu-related custom module, but I'm not sure how it would cause this issue because it's implementing hook menu_edit_form_alter. The only patch being applied is for viewsreference, so that shouldn't be a problem. We have another Drupal 9.5 site and it doesn't have the same issue (the inaccessible links don't appear for anonymous users), but that site is built in a more standard way (less custom code). I've struggled getting xcode working with phpstorm and lando, so I was just hoping someone might have had experience with this problem and what might have fixed it for them in the past. I found this:
// Only render accessible links. if ($data->access instanceof AccessResultInterface && !$data->access->isAllowed()) { continue; }
in /web/core/lib/Drupal/Core/Menu/MenuLinkTree.php (line 245), so it seems like the links shouldn't be displaying.
Thank you for the tip about debugging. I'll try to get xdebug working (fingers crossed!).