Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Recommendation: ModelViewAdmin

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 692 Views
  • Rawbit
    Avatar
    Community Member
    52 Posts

    Recommendation: ModelViewAdmin Link to this post

    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.

  • schellmax
    Avatar
    Community Member
    126 Posts

    Re: Recommendation: ModelViewAdmin Link to this post

    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

  • Hamish
    Avatar
    Community Member
    712 Posts

    Re: Recommendation: ModelViewAdmin Link to this post

    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.

    692 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.