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 /

Redirect after create


Reply


303 Views

Avatar
Eugene

Community Member, 2 Posts

13 April 2013 at 1:21am

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?