Problem/Motivation
All systemic changes in code have a standard way of communicating those changes to developers in a timely fashion to allow them to make changes to their customisations to support those changes.
Right now, if a token is changed there is absolutely no way to notify site-builders and other users of the token system.
Steps to reproduce
N/A
Proposed resolution
In order to make systemic changes possible in the world of tokens we need a communication channel to site-builders and users to indicate when tokens are flagged to become obsolete.
Even better would be an interactive UI to guide replacement of deprecated tokens, perhaps even facilitate automatic replacement where possible, and parallel drush commands.
Remaining tasks
Discuss and decide upon an approach
User interface changes
A new UI for managing tokens in-content?
API changes
Probably new public methods (maybe new service?) for managing tokens.
Data model changes
None foreseen at this time.
Comments
Comment #2
andypostComment #3
andypostComment #4
berdirQuick thoughts:
* Unlike API changes, this is something that needs to reach site builders as you wrote, so I guess non-suppressed watchdog warnings or so. This could happen _a lot_ though. And we have fairly little context to go by.
* We currently don't require the token info for many cases of token replacements, that will likely be quite a performance hit if we need to fetch info on deprecated tokens. Maybe optimized cache entries just for a list of deprecated tokens or something.
* There are also token types to think about, for example to rename term to taxonomy_term to get it back in sync with the entity type ID, we'd also want an alias system then.
* a bulk update system seems extremely complex and very likely way out of scope here. We have no knowledge where tokens are stored.
Comment #5
darvanen#4:
Comment #6
berdir2. We need to know that node:title is deprecated. And the obvious place to put that information would be on the token info declaration. So that it would be declarative, like deprecated services or config schema. The actual implementation could manually trigger a deprecation message, but that will only work for tokens, not token types. And if we have no declarative system then we definitely can't do any automated replacements.
4. Core doesn't actually have that many places where it supports tokens. Many are only added by contrib modules. IMHO this is clearly something for a contrib module to experiment on. It will need some kind of batch system, I'm not sure if it really should blindly replace everything in config that looks like a token, we'll have to experiment with that. We have no efficient way to query something like this across all config, we'd either need to load config directly from storage as a string or traverse it property-by-property.
Comment #7
darvanenFirst, pardon the dumb question, I think I may have finally put my finger on this but what is a
token typeas distinct from atoken? Are they respectively the first and second parts of[node:title]for instance?2. If we're worried about a performance hit perhaps there's a way we can cache the deprecations for runtime?
4. Ok. So without any kind of GUI it's up to the user to react to the watchdog/error messages as the default and then install a module if one is created? Makes sense to me. Makes this task a lot smaller too.