Access plugin options inside same plugin admin form field

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:

        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 Plugin Recipes | Grav Documentation 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 :slight_smile:

I believe you should keep field path same as usual:

[YOUR_PLUGIN]/templates/forms/fields/field_name/field_name.html.twig

And to access plugin config via Twig, check “Accessing Plugin Configuration Values via Twig”

1 Like

Thanks a lot @Karmalakas :slight_smile:

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