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

How to read Form metadata for a custom theme?

Started by Muut Archive 11 years ago · 3 replies · 300 views
11 years ago

What is the right way to read the metadata saved from a form in a custom theme under the admin panel? I have found where my data are saved (user/config/themes/mytheme.yaml) and now I'm looking for the best way to read them back, from a .twig template for example. Thanks in advance for your help!

A new Grav lover!

11 years ago

Something like {% if config.themes.mytheme.myfield %} ?

11 years ago

That simple? Thanks for your reply, I'll play with that and will let you know about my testing results.

11 years ago

Thanks Flaviocopes :) That was exactly what I was looking for. Here's my code snippet to display the text string which contains the Site Title that has been saved thru my theme form in the Admin panel:

TWIG
{% if config.themes.mytheme.branding.site.title %}
{{ config.themes.mytheme.branding.site.title }}
{% endif %}

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1345 9 years ago
Archive · by Muut Archive, 9 years ago
2 932 9 years ago
Archive · by Muut Archive, 9 years ago
2 4059 9 years ago
Archive · by Muut Archive, 9 years ago
1 2945 9 years ago
Archive · by Muut Archive, 9 years ago
3 1117 9 years ago