How to add a button to a CMS server that launches an action? I can display the button where I want to use:
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldsToTab("Root.ButtonTest", array(
FormAction::create('doAction', 'Action button')
)
);
return $fields;
}
public function doAction()
{
}
However, when a button is pressed, nothing is done.
I saw one example of how to put a button in the main action panel (next to save / publish), but this is not what I'm trying to do.
Having looked only on the documentation page , I can find, I need to do something inside:
public function getCMSActions()
{
$actions = parent::getCMSActions();
}
It is not clear how to create an action that triggers a button.
source
share