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 →

Access plugin options inside same plugin admin form field

Solved by Karmalakas View solution

Started by Brice Boucard 5 years ago · 2 replies · 674 views
5 years ago

Hi,

I'm trying to declare a new form field within a plugin, inside the admin/themes/grav/forms/fields/field_name/field_name.html.twig.

The new field is then declared through this piece of code:

PHP
        public function onAdminTwigTemplatePaths($event): void
    {
        $paths = $event['paths'];
        $paths[] = __DIR__ . '/admin/themes/grav/templates';
        $event['paths'] = $paths;
    }

In my field, I'd like to access the plugin configuration and use something like that : {{ plugin.plugin_name.option }} but It seems I can't make it work... I read https://learn.getgrav.org/17/cookbook/plugin-recipes#how-do-i-make-data-from-a but I'm not even sure it applies to my case... and if it is, I thinks I'm lost...

Thanks in advance for any suggestion :)

5 years ago

Thanks a lot @Karmalakas 🙂

Sometimes, I search much more complicated stuff than the actual simple way...

Suggested topics

Topic Participants Replies Views Activity
General · by themetman, 23 hours ago
2 40 16 hours ago
General · by Hanns Mattes, 1 week ago
0 121 1 week ago
General · by Karmalakas, 1 week ago
2 185 1 week ago
General · by Hanns Mattes, 3 weeks ago
0 235 3 weeks ago
General · by Dima, 4 weeks ago
1 211 4 weeks ago