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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Add Form Action Button to Specific pages using DataExtension


Go to End


2 Posts   738 Views

Avatar
Praveen

Community Member, 49 Posts

25 October 2014 at 11:57pm

Edited: 25/10/2014 11:58pm

I am creating an extension to add PublishSend form action button to Page.

class EmailPageExtension extends DataExtension {

private static $many_many = array(
'Subscribers' => 'Member'
);

public function doPublishSend($data, $form){

$task = singleton('PagePublishSendTask');

if ($task) {
$task->run($this->request);
}

if (Director::is_ajax()) {
return $this->getResponseNegotiator()->respond($this->request);
} else {
$this->redirectBack();
}
}
public function updateCMSActions(FieldList $actions)
{
//Create the new action
$sendButton = FormAction::create('doPublishSend', _t('Email.SendButtonTitle','Send Email'));
//$sendButton->describe(_t("Email.SendButtonDescrption","Publish and Email this item"));

//add it to the existing actions
$actions->unshift($sendButton);
return $actions;
}
}

Button is showing on the edit page.But control does not go to function doPublishSend();

Avatar
Praveen

Community Member, 49 Posts

26 October 2014 at 12:19am

I solved it by creating extension of LeftAndMain and placed the doPublishSend method.