Need to figure out how to create nested tokens from the array token type

Created on 21 June 2011, almost 14 years ago
Updated 22 February 2023, about 2 years ago

One step blocking Field tokens is we need to be able to create complex nested tokens using the array token type. If this can be solved independent of the Field token mess, like solving a [node:terms:first::tid] token we will be one step closer.

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dave reid Nebraska USA

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @Maintainers: Who can decide how to proceed here? And especially review the MR!26 from @DuaelFr so we can have a plan? :)

  • πŸ‡«πŸ‡·France duaelfr Montpellier, France

    I rerolled the MR on the latest dev version.

  • Pipeline finished with Success
    8 months ago
    Total: 150s
    #244579
  • πŸ‡¨πŸ‡¦Canada trevorkjorlien

    @duaelfr, I have used your patch on the latest version of Token. But I'm not seeing the changes as expected.

    I've tried multiple ways, trying to use a token as an argument for a View. Basically, showing a View and using a commerce order ID to get an order's details:

    [views:embed:event_registration_order:[commerce_order:order_id]]

    [views:embed:event_registration_order:commerce_order:order_id]

    [views:embed:event_registration_order::[commerce_order:order_id]

    [views:embed:event_registration_order::commerce_order:order_id]

    I've had the View display before without an argument. But with this, it's not appearing, or it just shows the order ID. Am I using this incorrectly? Thanks!

  • πŸ‡«πŸ‡·France duaelfr Montpellier, France

    I'm not sure I understand your use case and I'm not sure this patch would allow you to achieve your goal.

    My proposal is a very simple implementation of tokens for nested arrays (now I can see how it is confusing with the issue title and might be out of scope).

    Before my PR, it was not possible to access deep values of a nested array with tokens because the last part of the token was considered as a simple key, even if it contained colons. Now, if there is no value with the key and if it contains colons, we explode the key and use it as a nested array selector to get the value.

    I can't write examples because I'm on my phone but if it's still not understandable enough, tell me and I'll try again later.

Production build 0.71.5 2024