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

Replacing framework templates


Go to End


3 Posts   1033 Views

Avatar
Faloude

Community Member, 55 Posts

22 December 2016 at 5:06pm

Edited: 22/12/2016 5:07pm

I'm trying to replace a little bit of the FormField_holder.ss template, to alter some HTML in most fields in the back-end.

Solution
I placed the edited template in mysite/templates/forms/FormField_holder.ss

Problem
Unfortunately, the template is now also used in the front-end forms, which is not my intention

So the question is, what would be a better way to set a form field template for solely the back end fields? Of course without going over all fields and calling ->setTemplate

Avatar
martimiz

Forum Moderator, 1391 Posts

23 December 2016 at 8:23am

Just a thought - maybe check the current controler in your new template and either display the default holder or the adapted one, depending?

Avatar
Faloude

Community Member, 55 Posts

23 December 2016 at 9:15pm

@Martiniz do you mean to assign the custom formfield template in thepage controller? That would only affect front-end formfields and not the back-end's right?

Because I need the opposite way: replace cms form field holder template and use the framework default ones for front-end form fields