Problem/Motivation
I was surprised to see with many others that UUID of content entities (including but not limited to user and node) are not available as tokens. There is a related issue for the Token module that may cover this requirement as well, but I strongly believe that Drupal core should provide this for bundled content entities at least, just like it exposes internal ids as tokens.
Having UUIDs available as tokens could have multiple benefits. For example, numerical identifiers could be removed from path aliases in a way that permalinks would still work, unlike when human-readable but mutable entity labels are used in path aliases.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3466573
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:
- 3466573-expose-uuid-tokens
changes, plain diff MR !9115
Comments
Comment #2
mxr576There is also a contrib that tries to add this missing building block, unsupported, not actively maintained: https://www.drupal.org/project/tokenuuid
Comment #3
mxr576Also got the intel from @berdir on Drupal Slack that supporting UUIDs as a token probably was forgotten when the token system was migrated from Drupal 7, UUIDs were a new feature of Drupal 8+.
Comment #7
mxr576It is definitely much easier addressing this missing feature in Drupal core than in Token... Please review!
Comment #8
smustgrave commentedNice! And way to have the test coverage already done. Think we may need a simple CR to announce the new token available. Then should be good.
Comment #9
mxr576Created a CR, I hope I guessed the version right :)
Comment #10
smustgrave commentedBelieve that's the right version.
Comment #11
quietone commentedEverything looks in order here. Leaving at RTBC
Comment #12
anybodyRTBC+1!
Comment #15
larowlanI noticed we don't have any token integration for the following content entities
* block content
* workspace
* contact message
* shortcut
But I don't think there's any use-case for these. Personally I think there are already too many tokens (tokens, blocks and views data very fast cause OOM when reading from cache on a reasonable sized site).
But that ship has sailed and not made any worse by this issue.
Committed 19c8ac9 and pushed to 11.x. Thanks!
Comment #17
tolstoydotcomhttps://www.drupal.org/project/tokenuuid isn't unmaintained, I just pushed a D11 version. I was waiting on https://www.drupal.org/project/tokenuuid/issues/2928359 but when this patch is backported I assume tokenuuid can be marked as not needed.
Comment #18
mxr576Could you please also opt-in tokenuuid to SA coverage?