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.

Plugins

Get and use plugin config inside forms/data.txt.twig?

form

Solved by pamtbaau View solution

Started by p 3 years ago · 6 replies · 319 views
3 years ago

When I have a process like

TWIG
process:
    - save:
        filename: feedback.txt
        body: "{% include 'forms/data.txt.twig' %}"
        operation: add

in a form: is it possible to retrieve and use the settings of a specific plugin inside forms/data.txt.twig? How?

3 years ago

@pikim, What have you tried sofar?

3 years ago

@pamtbaau
E.g. {% set feature_enabled = config.plugins.name.feature %} in the first line of the twig and then use feature_enabled inside the script.

3 years ago

@pikim, And then what happened?

3 years ago

@pamtbaau
Regardless of whether the boolean config.plugins.name.feature is true or false, feature_enabled is always null.

3 years ago

@pamtbaau
Thanks! That solved the issue. I'm using {% set feature_enabled = context.config.plugins.name.feature %} inside the macro now.

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 43 1 week ago
Plugins · by Xavier, 4 weeks ago
2 53 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1179 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 47 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 72 2 months ago