How to chain tokens to get taxonomy term via node entity reference fields?

Created on 7 March 2024, 9 months ago
Updated 13 May 2024, 7 months ago

I'm attempting to insert a chained token in a file path and it's not working -- is this a supported pattern for filefield_path, or am I using incorrect token syntax?

[node:field_report_category:entity:field_report_topic_area:entity:name]

  • Node Type A has field_report_category as an entity reference field to content of Node Type B
  • Node Type B has field_report_topic_area is an entity reference field to a taxonomy term
  • I'm trying to get the taxonomy term name via Node Type A, but the above token doesn't output anything.

These tokens work, but don't produce the string I need:

  • [node:field_report_category:entity:field_report_topic_area] outputs an HTML link to the term name within the path, example:
    <a href="/report-topic-areas/term1" hreflang="en">term1</a>
  • [node:field_report_category:entity:field_report_topic_area:entity:tid] outputs the matching term ID, but I need the name rather than tid.
πŸ’¬ Support request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States sclsweb

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

Comments & Activities

  • Issue created by @sclsweb
  • πŸ‡¦πŸ‡·Argentina abelpzl

    I am facing a similar problem
    I need the folder where a file is saved to be formed with the id of a node related to the main node.
    Something like this:
    [node:field_a:entity:field_b:entity:field_c:entity:nid]
    This works correctly in the drupal 7 version of this module but not in 8.x

  • Status changed to Needs review 7 months ago
  • Use [node:field_report_category:entity:field_report_topic_area:entity:name]. ("name" instead of "tid")

  • Status changed to Active 7 months ago
Production build 0.71.5 2024