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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

ModelAdmin: two save buttons.


Go to End


3 Posts   1872 Views

Avatar
ramtamtam

Community Member, 7 Posts

13 January 2012 at 7:45pm

Edited: 13/01/2012 7:52pm

Hi,

i have a custom Object extended from Page that i want to manage in model admin. It has a many_many relation to an other object and is placed in a page holder with a has_one <-> has_many relation. As i expect a large number of elements being held in this object in the future, i would like to manage them in model admin.

I would like to remove one of the save buttons and make the "save and publish"- button work.

I browsed this forum and others and read posts for hours but did not find anything helpful. I appreciate any ideas.

Best regads!
ramtamtam

Avatar
ramtamtam

Community Member, 7 Posts

14 January 2012 at 5:30am

okay, so far i was able to remove one of the two save buttons. I inserted the following line in my MyCustomAdmin class in order to reference a record controller class:

public static $record_controller_class = 'MyCustomAdmin_RecordController';

and then created the class referenced in the same file like this:

class MyCustomAdmin_RecordController extends ModelAdmin_RecordController {
//manages everything to do with individual record
public function EditForm() {
$form = parent::EditForm();
$actions = $form->Actions();
$actions->removeByName('Save'); // remove save button from form
return $form;
}
}

Fortunately, the button that did not work was removed and not the other one. No idea why this is so.

Still i am facing the problem of a not working save-and-publish button. Im am thankfull for any help on getting this button working.

Best regads!
ramtamtam

Avatar
_Vince

Community Member, 165 Posts

24 June 2013 at 10:45pm

Edited: 24/06/2013 10:58pm

Hm... I'm having the same problem, too.

I am trying to manage pages from the modeladmin and I get the "Back", "Save" and "Delete" buttons as well as all the page ones. And I can't publish the pages, either.

Does anyone know how to sort this problem out, or why it's happening?

Oh, and the version is 2.4.9