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.

General

Access plugin options inside same plugin admin form field

Solved by Karmalakas View solution

Started by Brice Boucard 4 years ago · 2 replies · 343 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 Jerry Hunt, 4 days ago
2 99 16 hours ago
General · by pamtbaau, 21 hours ago
1 63 21 hours ago
General · by Andy Miller, 1 day ago
0 48 1 day ago
General · by Marcel, 12 months ago
6 357 5 days ago
General · by Duc , 6 days ago
3 45 6 days ago