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: two save buttons.


Reply

3 Posts   780 Views

Avatar
ramtamtam

13 January 2012 at 7:45pm (Last edited: 13 January 2012 7:52pm), Community Member, 5 Posts

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

14 January 2012 at 5:30am Community Member, 5 Posts

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

24 June 2013 at 10:45pm (Last edited: 24 June 2013 10:58pm), Community Member, 161 Posts

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