Allow looking up more content entity types in menu item autocomplete

Created on 14 March 2024, 6 months ago

Problem/Motivation

Drupal nowadays includes a cool feature that allows you to autocomplete paths when adding menu links. Unfortunately the MenuLink Autocomplete field can only autocomplete paths for nodes, ignoring other content entities (e.g. taxonomy terms).

Steps to reproduce

  1. Create a node of whatever content type (e.g. basic page);
  2. Create a taxonomy term
  3. Go to https://yourdrupalsite/admin/structure/menu/manage/main/add
  4. Start typing in the "path" autocomplete field the title of the node you created in step 1: notice how the field nicely autocompletes the reference for you.
  5. Do the same for the taxonomy term you created in step 2: nothing happens, you have to enter the full path in the old (un)fashioned way.

Proposed resolution

Menu link autocomplete field should autocomplete paths for each content entity, not only nodes; if unfeasible, it should at least include taxonomy terms.

Remaining tasks

Discuss and fix.

User interface changes

None

API changes

TBD

Data model changes

TBD, hopefully none.

Release notes snippet

TBD

โœจ Feature request
Status

Active

Version

11.0 ๐Ÿ”ฅ

Component
Menu systemย  โ†’

Last updated 1 day ago

Created by

๐Ÿ‡ฎ๐Ÿ‡นItaly falcon03

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Comments & Activities

  • Issue created by @falcon03
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cilefen
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly falcon03

    @cilefen I'm not sure I agree on considering this a feature request than a bug. Reading the help text "Start typing the title of a piece of content to select it. You can also enter an internal path "that is shown below the field it seems that its intended behavior would be to autocomplete paths for all "pieces of content" (and in deed taxonomy terms are content entities).

    Anyway this is at least a major usability issue, considering the fact that we do not have any simple way in core to add taxonomy terms to menus (like the options available for nodes).

    On a side note, the reason why after 10 or so years of work on entity field API and internal core architectures we still have to worry about implementations for each content entity is still a mistery for me, but that's another story :)

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cilefen

    Major bugs have no workaround โ†’ . You described the workaround above.

    Now that Iโ€™m thinking about this more, arenโ€™t taxonomy term pages a view? Views are not content entities.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly falcon03

    @cilefen fair enough; we should discuss wether that workaround is acceptable for being in 2024 (and of course I'd say no), but I do not want to bikeshed on this: we'd better have this discussion in a policy issue.

    Anyways I did not find anything on the fac that taxonomy term pages are now views; do you have the CR on hand? A quick Google search didn't help

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cilefen

    https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/taxon... but in fact it is optional. These are content entities otherwise.

Production build 0.71.5 2024