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
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
Comment #2
mably commentedComment #4
mably commentedMR !286 implements it.
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.
Comment #6
mably commented