Update-safe overrides for forms fields twig templates?

Hi there! While creating site using Grav CMS, I had to make some changes to .twig templates of some form’s fields. So, for beginning I just changed some .twig files, for example

Of cause, all my edits just were overwritten and lost during first attempt to update Grav and I’ve got the sabe basic versions that I’ve started from.

Ok, so I created special folders that were not exist before, and placed my templates there:

I thought, that as long as these folders are not native to plugin, they will stay intact during next update.

It seems that I was wrong, and while next update, these folders were again just wiped out, so my special fields just gone from form page.

So I have one very specific question: where should I place these twig templates, so that they keep on working and wouldn’t be wiped out again on next update??

Please, note, I don’t want to override WHOLE plugin, just a couple of templates for couple specific form fields.

Thanks in advance!

Hi, put them in user/themes/<themename>/templates/forms/... and replicate the path structure you see in the default plugin templates.

Are you using a child theme? If not, your theme will also be overwritten by an update.

I’m hoping that in the near future, Grav’s updaters will warn you about overwriting modified plugins and themes. Before that, you learn pretty quickly to put your modifcations in the correct safe places :anguished:

Hi again, I’m using Gantry Helium theme along with gantry plugin, there is no “/templates/” sub-folder in "/themes/ < themename > " folder. I created it manually, following instructions, but no luck. Any ideas?

ok, I’ve played a bit, and it seems that in case of Gantry framework correct path is:


and then replicate the path structure you see in the default plugin templates.

If you created an inherited theme, I don’t know this, but possibly it doesn’t create a templates subfolder because there aren’t any yet.

So try creating that “templates” folder and any subfolders required to put your overriding templates in the same location. Double-check that your new folders and files have the same ownership and file permissions as the parent theme.

thanks, I already figured out the solution.