If the Patternkit library is using Twig to render the patterns, we should support basic twig filters for schema entries.

These should be supported in all non-enum 'string' fields.

Desired Features

  • All of the basic Twig filters from: https://twig.symfony.com/doc/2.x/filters/index.html
  • A 'key' filter that will recursively pull the first matching array key - the use case here would be extracting metadata such as [node:field_image:0]|key('sources')
  • Little to no performance impact (so no re-rendering or skipping the Twig cache)

Example:

  [node:title]|title
  [node:source:body]|replace({'%foo': 'bar'})

Handling the key filter may be optional in this issue as it's typically been difficult to get at Drupal's nested field data especially where things like paragraphs or entity references are concerned.

Comments

cyb.tachyon created an issue. See original summary.

cyb_tachyon’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
slucero’s picture

Priority: Normal » Minor
Status: Active » Postponed