So I’m developing a plugin, which would show something like a plan feature comparison table
Plan 1
Plan2
Feature 1
v
v
Feature 2
x
v
Feature 3
x
v
I have a list of plans and list of features. What I want now, is to show a grid of inputs to save values of plan-feature relations.
I can’t figure out how to create such a thing. I can’t even create a simplest custom input field. I have my Twig template in user/plugins/my-plugin/templates/forms/fields/my-field/my-field.html.twig and I have it defined in my blueprint, but it still outputs the default text field. I also have
public function onGetPageTemplates(Event $event)
{
$locator = Grav::instance()['locator'];
$event->types->scanTemplates($locator->findResource(sprintf('plugin://%s/templates', $this->name)));
}
But I assume maybe for form field templates there’s something more required. Can’t find any docs
I think you should create within the root folder of your plugin a folder called admin/themes/grav/templates/forms and place your template there. Take a look at the modifications I made in the Deliver theme, in which I modified some field templates in the administration panel.
Look at the deliver.php file to adapt the code referring to the path of the Admin templates
you’re correct. adding onTwigTemplatePaths to both admin and not, now shows the field output. No need for getFormFieldTypes() or moving the template deep under /admin/... as @pmoreno suggested