Jump to:

5554 Posts in 1742 Topics by 1227 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Redirect after create

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

Page: 1
Go to End
Author Topic: 298 Views
  • Eugene
    Avatar
    Community Member
    2 Posts

    Redirect after create Link to this post

    When you create a new DataObject item in the CMS the default behaviour is that you're redirected to the item you just created.

    I would like to be redirected to a different CMS url, so I placed some redirect code inside onAfterWrite in my DataObject extension class:

    public function onAfterWrite() {
       parent::onAfterWrite();
       Controller::curr()->response->addHeader("X-ControllerURL", "admin/customurl");
       Controller::curr()->redirect('admin/customurl');
    }

    However this doesn't redirect me back to /admin/customurl.

    I have also tried not calling parent::onAfterWrite(); but still no joy.

    Could someone point me in the right direction please?

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