Forgive me for flooding the forum I’m new to SIlverstripe. I’m again stuck with adding a new button to the admin CMS. I’ve tried various approaches and can’t believe why this is so complicated.
I tried this with no luck.
I simply want to add another button here to say “save and finalise” or “save and exit”.
But I was unable to event the get that button appeared on the UI…!
Does anyone know of a good tutorial/ example that I can follow? The above example is missing a lot of information and I can’t figure out why it is not working.
This is one approach I’ve tried
public function getCMSActions() {
$actions = parent::getCMSActions();
$saveAction = new FormAction ('saveExit', 'Save and exit');
$saveAction->addExtraClass('ss-ui-action-constructive');
$actions->push($saveAction);
return $actions;
}
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main',
FormAction::create('saveExit', 'Save exit')
);
//other fields
return $fileds
}
I’ve managed to do this by extending the GridFieldDetailForm_ItemRequest because that one is responsible for rendering the edit form in the grin (surprise!)