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.
If we added entity information to {url_alias} like entity_type (node/term/user) and id (node ID, user ID) we could be able to look up what entities do not have aliases and allow contrib to be able to perform bulk aliasing on un-aliased content.
Comments
Comment #1
Dave ReidSo a better reasoning for this is instead of having to do the following SQL to find un-aliased nodes:
SELECT n.nid FROM {node} n LEFT JOIN {url_alias} alias ON CONCAT('node/', CAST(n.nid AS CHAR)) = alias.src WHERE alias.src IS NULL
We can do this!
SELECT n.nid FROM {node} n LEFT JOIN {url_alias} ua ON ua.entity = 'node' AND ua.id = n.nid WHERE ua.aid IS NULL
Ooh, and with this we could add a filter by type on the URL alias screen as well.
Comment #2
brianV CreditAttribution: brianV commentedA few thoughts:
1. Not every row can have an entity id and type, as aliases can be assigned to any valid Drupal path.
2. Would need code to determine entity type from URL in the case of paths generated via the path add form at admin/config/search/path/add. Code-based calls to path_save() can just require developers to populate the extra keys.
3. We would want to think well about how to display this on the url alias screen so the empty entity type rows would make sense.
Other than that, this is a useful function.
Comment #3
andypostRelated issue #1783964: Allow entity types to provide menu items
Comment #16
smustgrave CreditAttribution: smustgrave at Mobomo commentedWith 11 years of inactivity is this still a valid task?