Overwrite field.html.twig

Hi,

I have been playing with the form plugin, and didn’t like the way it structured the fields in the form, hence I tried to overwrite them. First I just replaced the field.html.twig/form.html.twig in the plugin, but noticed that that didn’t really work very well… taking into account updates etc.

After that I decided to place the files i wanted to overwrite in the templates folder as that seems a better way (my understanding is that grav will always first look there anyway).

Problem I face now is that for my contact form the new field.html.twig works like a charm. Unfortunately this also overwrites the fields used in the admin panel.

Is there anyway to overwrite the field.html.twig file used in the form plugin for 1 theme specifically? Or at least tell the admin plugin to use the default twig template found in the form plugin folder?

Yes, put the customized files in user/themes/yourtheme/templates/forms/, they will be overridden only in the frontend.

Okay, thanks… will play around a bit more… what you suggest is the setup i have now, but still my form fields in the admin section look different than they used to. I did a clean install of the form plugin to make sure, and still the admin form fields remain the same (aka… they look like the fields in my contact form)

I just figured out the problem… In case anyone else stumbles across this note that apparently using CSP headers breaks the admin plugin… seems i should either whitelist a couple of resources that are used, or allow ‘unsafe-eval’ or ‘unsafe-inline’ depending on what is used in the plugin…

Post this as an issue on the Admin Plugin repo on github, with some details, so we don’t lose track of it.