MillyMonster
MillyMonster

Reputation: 556

SilverStripe - DataObjects vs Pages

I have a simple question. I have to create objects which extend DataObject, but how do I allow users to create them through the CMS (i.e. the way pages are created)? They don't show up on their own in the list of stuff you can create.

I suppose my main question is what is the difference between a page and a dataobject?

(I am a complete SilverStripe novice so forgive me for being clueless about this)

Thanks in advance

Upvotes: 0

Views: 798

Answers (1)

Benjamin Smith
Benjamin Smith

Reputation: 887

Two common ways of doing this:

If the DataObject will be somehow related to pages, then you can attach your DOs to your page using the DataObjectManager (DOM) plugin. Overload the getCMSFields() function on your Page class to show the DOM. Note: the DOM has been replaced by the GridField in SilverStripe 3.0 - see the docs here.

If you DataObject is more of a freestanding entity, then the ModelAdmin is the way to go. This allows you to create new tabs in the CMS to manage your DataObjects. You can use these DataObjects on the front end as you see fit.

If all of this is baffling you, then I recommend you go through the 5 SS tutorials.

Upvotes: 1

Related Questions