How do I go about adding a button to the backend of the CMS?
I can display the button where I want using:
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldsToTab("Root.ButtonTest", array(
FormAction::create('doAction', 'Action button')
)
);
return $fields;
}
public function doAction()
{
//Do something
}
However, doAction does nothing when the button is clicked.
I've seen one example of how to put a button on the main action bar (Next to save/publish) but thats not what I'm trying to do.
Looking at the only documentation page I can find, do I need to do something within
public function getCMSActions()
{
$actions = parent::getCMSActions();
//Something here?
}
I can't find any clear documentation on how to handle the button action.
Note: Same question on SO if you want the rep https://stackoverflow.com/questions/23353998/adding-button-to-silverstripe-cms