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

Recommendation: ModelViewAdmin


Go to End


3 Posts   1204 Views

Avatar
Rawbit

Community Member, 52 Posts

20 March 2009 at 9:10am

In a recent thread I had asked about a need I had to fulfill a clients request. The need was fairly simple: allow the admin user to manage a list of links that appeared on every Page.ss in the CMS.

At first I had considered creating a special page type called GlobalLinks.php as an extension of Page. Then I would remove all of the tabs and fields except one tab that had a DataObjectManager to allow for managing of these links (drag+drop sorting, editing, add/remove, searching etc). However this has all sorts of problems including: 1.) the Page.ss will have to control the specific page name, if this changes by the clients unawareness - it breaks. 2.) The admin will see the ability to create more page types called GlobalLinks and they are essentially useless.

So then, with some help from stuckinrealtime on the forums, I setup a ModelAdmin. Unfortunately this is only a data manager. It does not allow for extensibility for such things as DataObjectManager (which provide the convenience as mentioned above of drag+drop reordering and instant listview without having to click 'Search').

So that is where I am now. I see the need for an extension of ModelAdmin called ModelViewAdmin. This will allow for more view flexibility when creating a ModelAdmin type class. You could be able to apply tabs/textfields/viewmodules such as in the SiteContent. This is probably a tremendous amounts of work, as it is certainly beyond me at this time - but I thought I would share this in hopes of some feedback as well as a chance of being developed in the future.

Avatar
schellmax

Community Member, 126 Posts

27 March 2009 at 5:49am

just had my first experience with modeladmin and was somewhat disappointed to find it doesn't support dataobjectmanager; also i tried to add images to an object using $has_many Images and found the modeladmin not being able to handle them - looks like it's too soon to use it.

anyway, something i don't understand regarding your post:
"At first I had considered creating a special page type called GlobalLinks.php as an extension of Page"
why don't you just extend DataObject? so your GlobalLink class 1) won't require you Page.ss file to know about it's name and 2) won't appear in the 'create' dropdown confusing your admin

greets

Avatar
Hamish

Community Member, 712 Posts

27 March 2009 at 8:19am

Rather than creating a new class, the functionality of the existing ModelAdmin should be extended.

File an enhancement ticket at http://open.silverstripe.com with the changes you would like to see.