The webform interaction context_display setting (added in #3608397) posts one Drupal message per entry, rendered as "label: value": the value comes from the entry variable, but the label is a plain, static string. There is no way to put dynamic content in the label, so a status line like "Reviewed by {a person}" or a label that varies with a process value is not possible today.

Proposal

  • Run each entry label through the core token service, exactly as the message interaction already does for its body: replace against the parked instance and branch (the orchestra and orchestra_token contexts), clear unknown tokens, and keep the default escaping so a resolved value is inserted as data, not markup.
  • Allow an empty variable, so a label-only entry renders just the tokenized label with no trailing ": value". A line such as "Reviewed by [orchestra:var:validator_uid:user:display-name]" then reads as a complete sentence.
  • Offer the token tree picker in the settings form when the optional token module is present, again mirroring the message interaction.

Resolving a person name already works

The motivating example is showing who reviewed a request. The examples capture the completer user id in validator_uid, and the orchestra var token already chains through an entity reference: ProcessTokens::chainReference() handles var:{name}:{entity_type}:{chain}, documented as [orchestra:var:validator_uid:user:display-name]. So no name capture or new token is needed; once the label is tokenized, that chained token resolves the reviewer name directly. This issue is therefore just the label tokenization and label-only lines.

Tests

  • A label containing [orchestra:var:NAME] resolves against the instance and branch.
  • A label containing a chained reference such as [orchestra:var:validator_uid:user:display-name] resolves the referenced entity.
  • An empty variable yields a label-only line (no ": value").
  • Resolved values stay escaped (no markup injection through a variable value).

Issue fork orchestra-3608435

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

Issue summary: View changes

mably’s picture

Status: Active » Needs review

MR !286 implements it.

  • ContextMessages runs each label through the core token service, so [orchestra:var:NAME], entity chains like [orchestra:var:validator_uid:user:display-name] and global tokens resolve in a label; inserted values are escaped and the label goes in as a Markup placeholder, so there is no double escaping.
  • Omitting the variable (a leading "|" in the settings textarea) renders a label-only status line with no trailing value; an entry with neither variable nor label is dropped.
  • The request-validation examples now show a label-only "Reviewed by [orchestra:var:validator_uid:user:display-name]" line on the process step, so no name capture is needed.

Covered by ContextMessagesTest (label token, label-only line, value stays escaped) and RequestValidationTest (the processor sees "Reviewed by {validator name}" over HTTP). Verified on a live site.

  • mably committed aec790b0 on 1.x
    feat: #3608435 Allow tokens in context_display labels, and label-only...
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.