Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Access plugin options inside same plugin admin form field

Solved by Karmalakas View solution

Started by Brice Boucard 4 years ago · 2 replies · 570 views
4 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 :)

4 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 Andy Miller, 1 week ago
0 139 1 week ago
General · by lynbor, 1 month ago
3 455 2 weeks ago
General · by lynbor, 3 weeks ago
7 590 2 weeks ago
General · by Harry, 2 weeks ago
0 176 2 weeks ago
General · by Old Man Umby, 1 month ago
2 318 4 weeks ago