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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Archive

Processing Twig in theme config text fields

Started by Muut Archive 9 years ago · 0 replies · 380 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 1318 9 years ago
Archive · by Muut Archive, 9 years ago
2 915 9 years ago
Archive · by Muut Archive, 9 years ago
2 4024 9 years ago
Archive · by Muut Archive, 9 years ago
1 2900 9 years ago
Archive · by Muut Archive, 9 years ago
3 1082 9 years ago