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

GenericViews - Extend CollectionController


Go to End


1167 Views

Avatar
midoriberlin

Community Member, 5 Posts

19 October 2011 at 5:25am

Hello all,

I'm using GenericViews for basic CRUD on two datatypes - Book and Chapter. What I want to have are custom functions for the various actions on each datatype e.g. add, edit, view etc.

I can handle the display part of it by creating .ss files such as Book_view.ss and so on. That bit works fine. What I can't seem to do is override CollectionController.

Initially tried adding a controller class in Chapter.php but that is extending Dataobject and doesn't seem to do anything. Also tried creating a separate file called ChapterController and trying from there but that also doesn't seem to be working.

I think I could probably distinguish between the datatypes I want in the add() and addForm() functions in CollectionController itself but that doesn't seem like the smart way to do it at all.

Anyone else had a similar problem or have any advice?

Any help very much appreciated.

Regards,

Andrew