Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

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

form

Solved by pamtbaau View solution

Started by p 4 years ago · 6 replies · 635 views
4 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?

4 years ago

@pikim, What have you tried sofar?

4 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.

4 years ago

@pikim, And then what happened?

4 years ago

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

4 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 DrPen, 1 month ago
2 478 1 month ago
Plugins · by renedebaaij, 2 months ago
1 350 1 month ago
Plugins · by Thomas, 1 month ago
1 375 1 month ago
Plugins · by complanar, 2 months ago
6 699 2 months ago
Plugins · by BenLaKnet, 2 months ago
1 642 2 months ago