Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » ModelAdmin: two save buttons.

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

Page: 1
Go to End
Author Topic: 764 Views
  • ramtamtam
    Avatar
    Community Member
    5 Posts

    ModelAdmin: two save buttons. Link to this post

    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

  • ramtamtam
    Avatar
    Community Member
    5 Posts

    Re: ModelAdmin: two save buttons. Link to this post

    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

  • _Vince
    Avatar
    Community Member
    161 Posts

    Re: ModelAdmin: two save buttons. Link to this post

    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

    764 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.