Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Processing Twig in theme config text fields

Started by Muut Archive 9 years ago · 0 replies · 384 views
9 years ago

I'm wondering if there is a way to process twig in the text of a Theme field, the only thing I could find pre-existing was the evaluate() function but that expects just valid twig content.

e.g. the template I'm working on has a Copyright Footer field of type markdown and it's rendered into the footer of the template using the markdown filter provided in GRAV.

TWIG
{{ theme_config.copyrightFooter|markdown }}

So text like this:

TXT
© My Company, 2017
_Sydney, Australia_

Renders like this:

© My Company, 2017
Sydney, Australia

Ideally I'd like to be add some dynamic elements, like a date range for the copyright e.g.

TWIG
© My Company, 2001 —  {{ "now"|date("Y") }}
_Sydney, Australia_

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1323 9 years ago
Archive · by Muut Archive, 9 years ago
2 919 9 years ago
Archive · by Muut Archive, 9 years ago
2 4048 9 years ago
Archive · by Muut Archive, 9 years ago
1 2923 9 years ago
Archive · by Muut Archive, 9 years ago
3 1106 9 years ago