Created
June 13, 2011 15:58
-
-
Save nickdunn/1023056 to your computer and use it in GitHub Desktop.
Extension: Save And Close
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Class Extension_Save_And_Close extends Extension { | |
public function about() { | |
return array( | |
'name' => 'Save And Close', | |
'version' => '1.0' | |
); | |
} | |
public function getSubscribedDelegates() { | |
return array( | |
array( | |
'page' => '/publish/new/', | |
'delegate' => 'EntryPostCreate', | |
'callback' => 'redirectAfterSave' | |
), | |
array( | |
'page' => '/publish/edit/', | |
'delegate' => 'EntryPostEdit', | |
'callback' => 'redirectAfterSave' | |
), | |
); | |
} | |
public function redirectAfterSave($context) { | |
redirect(sprintf('%s/publish/%s/', SYMPHONY_URL, $context['section']->get('handle'))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment