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.

Customising the CMS /

ModelAdmin without a DataObject - Static page


Reply


3 Posts   369 Views

Avatar
Double-A-Ron

Community Member, 604 Posts

5 March 2014 at 2:27pm

SS 3.1

I have need for a section in the the CMS admin where one tab is a GridField for a DataObject, but the other is a small form (one field, one button) linked to nothing. The action on the form will be completely custom and external to Silverstripe.

The DataObject is fine as per documentation, but how do I add a tab to this ModelAdmin that contains nothing more than static HTML?

I've downloaded both the Dashboard and SwipeStripe modules to get some guidance, but I can't decipher the structure in either.

Avatar
Willr

Forum Moderator, 5513 Posts

6 March 2014 at 8:07pm

ModelAdmin is designed for managing your DataObjects, if you want to push additional fields into an existing ModelAdmin you can override getEditForm() in your ModelAdmin subclass to provide additional buttons etc. If you just want a generic panel in the admin you can manage, subclass 'LeftAndMain'. An overview is available at http://doc.silverstripe.org/framework/en/reference/cms-architecture

Avatar
Double-A-Ron

Community Member, 604 Posts

6 March 2014 at 8:48pm

Thanks again Will,

Since posting I've started playing with the second option, LeftAndMain, loosely based on the default SiteAdmin -> SiteConfig relationship and overriding getCMSFields as per SiteConfig.

Limited success so far. I have a manual form displaying, and a dataObject form displaying (the later I plan to replace with a read-only GridField). But they're all on one page instead of split over two tabs as I have defined.

Actually I think they really are split, but the tabs are just links sitting in the top right corner. E.G. I'm missing some JS for handling the tabs.

Will continue in the morn and post my code for future ref on success. There's not much specifically for this sort of thing out there.