Skip to content

Commit

Permalink
Add PageTemplatePreCreate and PageTemplatePostCreate delegates, RE: #640
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendan Abbott committed May 26, 2011
1 parent 1119828 commit 00df41d
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions symphony/content/content.blueprintspages.php
Expand Up @@ -1162,10 +1162,41 @@ protected function __updatePageFiles($new_path, $new_handle, $old_path = null, $

}
else{
$data = file_get_contents($old); @unlink($old);
$data = file_get_contents($old);
@unlink($old);
}

return General::writeFile($new, $data, Symphony::Configuration()->get('write_mode', 'file'));
/**
* Just before a Page Template is about to be created & written to disk
*
* @delegate PageTemplatePreCreate
* @since Symphony 2.2.2
* @param string $context
* '/blueprints/pages/'
* @param string $file
* The path to the Page Template file
* @param string $contents
* The contents of the `$data`, passed by reference
*/
Symphony::ExtensionManager()->notifyMembers('PageTemplatePreCreate', '/blueprints/pages/', array('file' => $new, 'contents' => &$data));

if(General::writeFile($new, $data, Symphony::Configuration()->get('write_mode', 'file'))) {
/**
* Just after a Page Template is saved after been created.
*
* @delegate PageTemplatePostCreate
* @since Symphony 2.2.2
* @param string $context
* '/blueprints/pages/'
* @param string $file
* The path to the Page Template file
*/
Symphony::ExtensionManager()->notifyMembers('PageTemplatePostCreate', '/blueprints/pages/', array('file' => $new));

return true;
}

return false;
}

protected function __deletePageFiles($path, $handle) {
Expand Down

0 comments on commit 00df41d

Please sign in to comment.