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
- Create a node of whatever content type (e.g. basic page);
- Create a taxonomy term
- Go to https://yourdrupalsite/admin/structure/menu/manage/main/add
- 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.
- 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
Comments
Comment #2
cilefen commentedComment #3
falcon03 commented@cilefen I'm not sure I agree on considering this issue a feature request rather 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 :) Something I'd like to understand better now that I'm coming back to Drupal after several years
Comment #4
cilefen commentedMajor 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.
Comment #5
falcon03 commented@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
Comment #6
cilefen commentedhttps://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/taxon... but in fact it is optional. These are content entities otherwise.
Comment #7
pameeela commentedThis came up in context of including Canvas page entities in the autocomplete, which we will want to do. Something like what is proposed in #3317769: Add support for linking to entities in CKEditor 5 would be good I think, so that core can provide defaults but modules can opt their entities and bundles in where relevant?
Comment #8
damienmckennaNow that #3317769 has been committed to core this can be worked on.
It might be worth providing a list of content entities in the text format configuration and letting site builders control which ones are allowed.
Comment #9
pameeela commentedI think it would be better to have this as global config somewhere since it doesn’t apply only to the text format. I’m not sure where but having settings in the text format that controls menu link settings just feels odd.
Comment #10
pameeela commentedI just realised that #3562968: Add autocomplete link field widget (similar to Linkit) is basically solving this, so we should probably close it as a duplicate? I’ll go through the related issues and try to consolidate.
Comment #11
pameeela commentedYep I think it makes sense to focus this on #3562968: Add autocomplete link field widget (similar to Linkit) for now, we can figure out the UI piece later but that issue would at least add support for making this configurable in code.