Jump to:

5541 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Sending Response after Publish

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

Page: 1
Go to End
Author Topic: 267 Views
  • Silverfish
    Avatar
    Community Member
    59 Posts

    Sending Response after Publish Link to this post

    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.

    267 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.