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.

All other Modules /

Discuss all other Modules here.

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

Extending Comments


Go to End


2 Posts   904 Views

Avatar
adambuczek

Community Member, 5 Posts

16 March 2014 at 12:02pm

Edited: 16/03/2014 12:02pm

I'd like to extend AddCommentForm so I can output field labels with custom classes. I want to remove 'left' class from label as it conflicts with Foundation but ideally I want to have full control over outputted HTML.

I tried to extend CommentingController in mysite/code but no luck there...

Can I set it up so every field type has it's own .ss template?

How do I do this?

Avatar
Willr

Forum Moderator, 5523 Posts

23 March 2014 at 6:21pm

You can have full control over the form markup by providing a custom CommentsInterface file. By default the form part is just dumped out using the standard form template but that doesn't need to be. See http://doc.silverstripe.org/framework/en/topics/forms#custom-form-templates for an example of the form markup (you can use <% with AddCommentForm %> to jump into the scope of the add view.