Recettes informatiques simples et efficaces

Blog

Nov 19, 2011

Extends your croogo plugin with TinyMCE


The TinyMCE plugin of Croogo requires that you change the bootstrap of the plugin in order to activate it for your own plugins. It is a problem when you want to leverage the power of plugin automatic install / uninstall of croogo.

Consider using following code in your plugin bootstrap in order to get rid of tweaking the bootstrap that doesn't belong to you !

$extraTinymceActions = array();
$extraTinymceActions['YourController/admin_edit'] = array( array('elements'=>'YourModelContent'));
$initialTinymceActions =  Configure::read('Tinymce.actions');
foreach ($extraTinymceActions AS $action => $settings) {
$initialTinymceActions[$action] = $settings;

$actionE = explode('/', $action);
Croogo::hookHelper($actionE['0'], 'Tinymce.Tinymce');
}
Configure::write('Tinymce.actions', $initialTinymceActions);