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.

All other Modules /

Discuss all other Modules here.

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

Extending Comments


Reply


2 Posts   342 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, 5513 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.