Follow-up to #3607623 (nested variable paths).

[orchestra:var:NAME] resolves a process variable to its stored value. Variables often hold an entity reference id: a user id (a captured completer such as validator_uid, or a submitter), a node id, a booking id. Today the only way to show a field of the referenced entity (for example the validator's display name in a notification) is to snapshot each field into its own variable, which does not scale (one config/variable per field you want).

Proposal: let a var: token chain into a target entity's own tokens, with the entity type named in the token:

[orchestra:var:validator_uid:user:display-name]   -> the user's name
[orchestra:var:validator_uid:user:mail]           -> the user's email
[orchestra:var:some_node_ref:node:title]          -> a referenced node's title

Mechanism (in ProcessTokens): for a token of the form var:{name}:{entity_type}:{rest}, if {entity_type} is a registered entity type, load that entity by the variable's scalar value and hand {rest} to the core token generator for that type (Token::generate()). So it reuses every existing [user:*], [node:*] token for free, and generalizes to any entity-reference variable.

The bare [orchestra:var:NAME] keeps returning the raw value as today; only the chained form loads an entity. The type is explicit in the token (never guessed from the value), and an unresolvable reference clears to empty.

Issue fork orchestra-3607693

Command icon 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:

Comments

mably created an issue. See original summary.

mably’s picture

Status: Active » Needs review

  • mably committed cd576665 on 1.x
    feat: #3607693 Chain [orchestra:var:NAME] into a referenced entity's...
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.