Problem/Motivation

If you update the name of a content type, then the new chosen name is not reflected in the menu item in the create menu in the navigation sidebar - the name is not getting updated.

Steps to reproduce

  • go to admin/structure/types/manage/article
  • change the name from Article to for example Articles to Follow
  • save the content type.
  • go to the navigation sidebar and into the create sub menu
  • the menu item is still called Article
  • after a cache clear the new name is shown

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#13 exploration.mp42.79 MBrkoller
#8 test.mp41.87 MBrkoller

Issue fork drupal-3569243

Command icon 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

rkoller created an issue. See original summary.

plopesc made their first commit to this issue’s fork.

plopesc changed the visibility of the branch 3569243-updates-to-content to hidden.

plopesc’s picture

Status: Active » Needs review

Moving to NR. The PHPStan error seems unrelated to the MR.

dcam’s picture

You only need to rebase the MR. That PHPStan problem was fixed in main earlier. This must have been forked during the brief time this morning when the baseline was wrong.

plopesc’s picture

Thank you for the heads-up!
Pipeline is Green now.

rkoller’s picture

Status: Needs review » Needs work
StatusFileSize
new1.87 MB

thank you for tackling this! i've only manually tested. at the beginning it was odd. the create sub menu wasnt updated not only for changed menu item labels but also if you added or deleted an entity type. i'Ve recorded some playing around. but during that test the adding and the deletion of entity types was correctly reflected in the create sub menu. but if changed the name of an existing content type that wasnt updated. tested on macos 26.3.1 on safari 26.3.1 (in case if that matters). setting it back to needs work

rkoller changed the visibility of the branch 3569243-updates-to-content to active.

rkoller changed the visibility of the branch 3569243-updates-to-content to hidden.

rkoller’s picture

apologies for the noise, was testing something in coder and by accident unhid the hidden branch - reverted my mistake.

plopesc’s picture

Status: Needs work » Needs review

Thank you for the recording. It was very helpful.

Back to NR.

rkoller’s picture

Status: Needs review » Needs work
StatusFileSize
new2.79 MB

thank you! did another round of tests. did some editing and changing of the entity type name which is now reflected in the sub menu. but the update for creating and deleting entity types is sort of flaky. at first it looked ok. but after some playing around it turns south. as soon as things arent up to date anymore the sub menu is always one change behind the entity type. another odd detail i was able to reproduce more than once. i create a node (bbb), then rename it (bbbB), then delete it. then when i create another new node with the previous name (bbb) the sidebar uses bbbB the name the deleted node got renamed to. plus the sorting order in the create submenu isnt always sorted in a alphabetical manner it looks like? .and it has to be noted ive only tried it with content types so far. i can expand the test to other entity types as well.

plopesc’s picture

Status: Needs work » Needs review

Thank you for the in depth testing.

Found out that the issue was related to how routes are being rebuilt after saving the content types, that force a route rebuild happening at the terminate phase, once the response is sent.

Ended up forcing to rebuild the dynamic menu links as part of the entity type insert/update/delete to ensure that links are properly generated in the next page load.

berdir’s picture

Didn't test, but forcing a rebuild is likely going to significantly impact installations of large install profiles/recipes with many node/media types.

plopesc’s picture

Good point.
I did not considered the possible implications during installation phase.
Do you have a in mind a possible alternative?
What I experienced locally was that even if the rebuild is triggered during the bundle creation, it happens during the terminate phase of the request. And locally, maybe not in real scenarios, seemed that the navigation was built at a point where the custom content links built on the fly were not ready yet. Forcing to to ensure that rebuild happens before the response is sent helped to address the issue. Initially tried invalidating the content menu cache tags, but it did not work.

berdir’s picture

I agree that's not perfect, but if they correctly rebuild at some point, that might be acceptable? If it's an issue for tests, we have a feature in place that allow a test to wait for that, see WaitTerminateTestTrait. It's a tradeoff with the delayed rebuild/terminate event in general. If we think it's a UX problem for cases like this, we could possibly build in a feature that allows certain things to flag that we want to hold back the response and run terminate before that? Not sure.

I'm wondering if a long-term solution would be to build this create menu on the fly instead of indirectly through menu links. I understand that menu links allow to customize it, but I'm not sure if a mix of manual links and generated ones play so well together anyway. And it was probably the most convenient option. Then we could add a cache tag on entity_bundles or so and this would automatically invalidate and rebuild as necessary.

Something like \Drupal\Core\Entity\Controller\EntityController::addPage().

I'm also not sure how well the current feature scales, what about sites that have 20, 30+ node types, how does the UI look then? I think it's generally less common than it used to be in D7, but possibly that's also influenced how we build our projects. A fully dynamic block would allow more flexible solutions for that, like grouping or expand/collapse features.

plopesc’s picture

Worst case scenario, the data would be synced after a cache clear.
And the creation/modification/deletion of bundles is not an operation that happens very often once the site is more or less stable.
Could we live with this for now?
This issue might address the update related issues and leave the add/delete, which affect to routes, for a later discussion.

rkoller’s picture

Thanks a lot for the additional fixes @plopesc!. Did another round of testing and I am unable to trigger the problems i ran into previously. that looks good! The only detail I consider odd is the order of menu items. It feels sort of arbitrary. Before my test i had the following content types ( i omit the the menu items for the other entity types and focus only on the content types to make the point)

Article
Basic pages
Validation

and the submenu was identical. after some experimentation the list of content types looked like

aaaAAA
Article
Basic Pages
moreEEEE
Validation
what

while in the submenu you get

Article
Basic Pages
Validation
aaaAAA
moreEEEE
what

probably out of the scope for this issue. but it is pretty odd and unexpected. and i completely agree with @berdir the current implementation might be challenging for sites with more than 4 or 5 node types. The create menu has a few more problems we've discussed the topic the last two usability meetings (#3574712: Drupal Usability Meeting 2026-02-27 & #3576210: Drupal Usability Meeting 2026-03-06). i am currently in the process of writing up the last summary for the issue that deals with the create menu (#3457729: Grouping or prioritisation for items in create menu). in the context of sites with x number different entity types at this point there is no way to define which entity types should be displayed on the create sub menu and which should be excluded. there is currently also no way to decide which role has which entity types available in the create menu. at the moment it looks like all content types are displayed while for the available media types only a few are displayed - but it looks like there is no way to control that (except manually adding or removing menu items on the content menu. then there is also the problem with the flat list of entity types, a user is unable to recognize the type of entity a menu item stands for - in particular tricky in cases where for example a media and a content type have the same name. there are no additional cues helping the user to recognize what type of entity a menu item stands for. the user has to read and remember. the cognitive load is high due to those masked objects.

berdir’s picture

Thanks for that reference, I wasn't following that and the linked #3573730: Improve usability of 'Create' menu in navigation. Following both now. I did see that the very old #2377543: Add "Add" item to toolbar. was also mentioned there, sounds like we're going full circle on that now.

Not surprised that the order isn't in sync, but I feel like trying to solve that with the current menu link approach is pretty futile, especially when you add manually created links to the mix then it is pretty impossible to manage.

At this point I'm not entirely sure if we even want to do these imperfect fixes this if we're really going to make major changes to that section and possibly replace this code completely. Maybe we should figure out first how the preferred solution would look like and how we'd build that? Some ideas sound like we'd essentially reintroduce shortcuts module just as we're deprecating it (letting users mark which things they want to see there).

plopesc’s picture

Status: Needs review » Needs work

Taking a break and decide the long term requirements sounds a sensible a this point.

There are different issues trying to make improvements to that part, and some coordination might be necessary.

Is the current implementation highly opinionated and maybe we need something simpler? Or maybe just move the current menu to the standard profile and let site admins to customize them manually after installation? Or a configurable block, as mentioned in a previous comment where a set of bundles can be chosen?