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.

Customising the CMS /

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

Sending Response after Publish


Go to End


2 Posts   1623 Views

Avatar
Silverfish

Community Member, 59 Posts

19 December 2013 at 10:13pm

Edited: 19/12/2013 10:13pm

Hello,

in a page type extending SiteTree I am overwriting doPublish() to perform some checks before and then decide wether to publish or not. Now I am looking for a way to get a message back to the user if publishing was blocked. Even I searched for two days now I only found the manipulation of the response description yet, which is displayed as a black, fading message box. This would be fine for me, but customer finds it not "alerting" enough, so I am urgently looking for a way, to send any custom HTML / Javascript signal.

See the Code, might explain it better:

public function doPublish() {
	if ( check_something() ) {
		#this works fine, but isn't enough
		Controller::curr()->getResponse()->setStatusCode(500, 'Not Published!');
		
		# here i would like to send any HTML / javascript signal back to the CMS admin ui.
		
		return false;
	}
	parent::doPublish();
	return true;
}

I would be very happy for any hint or idea!

I wish you nice holidays,

cheers

SF.

Avatar
mi32dogs

Community Member, 75 Posts

25 January 2016 at 8:07am

I know it is an old post, but did you ever found an answer? as i'm trying to do the same thing