Skip to content

Instantly share code, notes, and snippets.

@nickdunn
Created June 13, 2011 15:58
Show Gist options
  • Save nickdunn/1023056 to your computer and use it in GitHub Desktop.
Save nickdunn/1023056 to your computer and use it in GitHub Desktop.
Extension: Save And Close
<?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