Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

How to Override Template in Userforms 3.x (solved?)


Go to End


1083 Views

Avatar
tazzydemon

Community Member, 135 Posts

1 December 2015 at 9:20am

Edited: 01/12/2015 10:19am

I decided to report this in a different form as it's not a template question per-se but perhaps a framework question.

I have upgraded a dev site to 3.2.1 and also taken Userforms to a similar 3.1 release.

I tend to override my userforms templates in my theme directory but now they all have a UserForms prefix and even copying them en-masse to my template directory does not make them get used as per the evidence in showtemplate=1 . They are in the manifest though eg:
[code
}s: 22: "userformsdropdownfield";a: 2: {
s: 4: "main";s: 66: "/home/ss/public_html/userforms/templates/UserFormsDropdownField.ss";s: 6: "themes";a: 1: {
s: 5: "pulse";a: 2: {
s: 5: "forms";s: 75: "/home/ss/public_html/themes/pulse/templates/forms/UserFormsDropdownField.ss";s: 9: "userforms";s: 79: "/home/ss/public_html/themes/pulse/templates/userforms/UserFormsDropdownField.ss";
}
}

I can only get the copies in use by deleting the orginals. Of course I cannot rely on that sort if thing if I am to use composer to deploy.
I also noticed that if I put the templates in /mysite then they are used, but not when placed in /themes/mytheme-userforms or themes/mytheme.

Mysterious.

So, how do I override Userform 3.x templates?

Postscript. I believe the template position in the new Userforms 3.x module is incorrect, therefore preventing overriding them without replicating it and destroying previous template practice which was to replicate the folder structure in framework, whereby the main form element (Form.ss) is in templates/Includes but the rest are in templates/forms
The Userforms module puts all its templates in the root of its templates directory meaning that correct form structure replication in my site templates fails. This will be raised as an issue