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.

Customising the CMS /

Sending Response after Publish


Reply


353 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.