Rules 8.x decided to use Twig-style token replacements to provide more flexibility by using filters.

Example tokens will look like the following:

{{ node.field_integer.2.value | default('0') }}
{{ node.title.value | default('tEsT') | lower }}

For now, look at the PlaceholderResolver class to see how it has been implemented and the following issues: #2650440: Add data filter plugins, #2648918: Add new token replacement API (service), #2650426: Document twig syntax for placeholder replacements.

Further tasks are available as sub-issues.

This is an alternative approach to the token module, see their related issue: #2430827: [meta] Improve field support and add test coverage

Comments

fago created an issue. See original summary.

fago’s picture

Status: Active » Fixed

Converted Rules token processor to use the new system, so let's call this fixed.

  • fago committed 966b593 on 8.x-3.x
    Issue #2632564 by fago: Make use of the new placeholder token...
klausi’s picture

Status: Fixed » Needs work

Left a comment in https://github.com/fago/rules/pull/358

Shouldn't this convert stuff to use "." instead of ":" separators?

fago’s picture

Status: Needs work » Fixed

>Shouldn't this convert stuff to use "." instead of ":" separators?

Yep, I fixed that already in a follow-up. Check 8.x-3.x.

Status: Fixed » Closed (fixed)

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

dasjo’s picture

Title: [META] Add entity token support » [META] Token support

renaming this to cover all token-related efforts (entity, typed data, twig-style replacements, ...)

dasjo’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

Reopening to summarize what we have done related to tokens so far and to keep track of further issues via sub-tasks.

dasjo’s picture

Title: [META] Token support » [META] Rules Twig-style Token support
fago’s picture

Status: Active » Fixed

I don't think keeping this open gives the right picture: it looks like it is not implemented, but it is. Maybe we can do a new meta for token system improvements?

-> Setting this to fixed to avoid further confusion.

Status: Fixed » Closed (fixed)

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