Remove Token dependency

Created on 2 January 2025, 20 days ago

Problem/Motivation

The AI module requires the contrib Token module as a dependency, using it's TreeBuilder service in a number of places to obtain information about available tokens. The Core Token utility service can provide this information, and its theme_token_tree_link implementation provides a pre-formatted help text that is performant and more familiar to users.

Proposed resolution

Refactor the code to use the Core Token utility service and remove the dependency on the contrib Token module.

πŸ“Œ Task
Status

Active

Version

1.0

Component

AI Core module

Created by

πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @MrDaleSmith
  • Merge request !371Remove token dependency β†’ (Open) created by MrDaleSmith
  • Pipeline finished with Failed
    20 days ago
    Total: 728s
    #383965
  • Pipeline finished with Failed
    20 days ago
    Total: 305s
    #383978
  • Pipeline finished with Success
    20 days ago
    Total: 468s
    #383987
  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith
  • πŸ‡©πŸ‡ͺGermany marcus_johansson

    Since we are still using theme token_tree_link it will be missing when its not available. We should check if the token module is available before opting to render it to not cause those warnings.

    See:

    We should probably write out a message that if they want to see the possible Tokens, they need to install and enabled Token module. This is confusing otherwise if you are not aware of the Token module:

    Also the Token module should be suggested in composer json as important to the Automators.

  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

    I’m not sure it’s worth doing the full remove of token if that theme function isn't part of core - it is something we want to be using. Otherwise we have to come up with our own version of it and it’s just not worth the effort. I say we add Token as a full dependency of the AI module but keep the other changes: you can use tokens without token but you can’t display which ones you can use without a lot of custom code, and doing a check if the module exists just so we can show the help text feels daft.

Production build 0.71.5 2024