Hi!
I have encountered the following problems while trying to add two custom plugins to ckeditor using hook_ckeditor_plugin.
I use the latest dev version of the module at that moment - 6.x-1.10 - release date March 23, 2012
I have two modules and I have defined the hook_ckeditor_plugin in every of them. The sample of hook body was borrowed from README.txt file (which in fact is the same as template in ckeditor.api.php)
After a hour of investigations I have suspected that problem lies as in the method of defining data in hook_ckeditor_plugin as far as in body of ckeditor_load_plugins() function. Let me provide a snapshot of dpm() call inside ckeditor_load_plugins() that is executed right after
$plugins = module_invoke_all('ckeditor_plugin');
dpm($plugins);
As you can see from structure of $plugins variable (in attached image) it could not be successfully processed in the foreach clause that is followed immediately after call to module_invoke_all.
Here is the sample of how hook body should looks like from README.txt
function MODULENAME_ckeditor_plugin() {
return array(
'plugin_name' => array(
// Plugin name.
'name' => 'plugin_name',
// Plugin description - it will be displayed in the plugins management section of the profile settings.
'desc' => t('Plugin description'),
// The full path to the CKEditor plugin directory, trailing slash included.
'path' => drupal_get_path('module', 'my_module') . '/plugin_dir/',
// Plugin buttons definition (optional).
'buttons' => array(
'button_name' => array('label' => 'Button label', 'icon' => '/path/to/icon/image'),
'button_name' => array('label' => 'Button label', 'icon' => '/path/to/icon/image'),
...
)
)
);
}
| Comment | File | Size | Author |
|---|---|---|---|
| cke_issue_attachment.png | 41.07 KB | ruslan.muradov |
Comments
Comment #0.0
ruslan.muradov commentedupdate to description of the task
Comment #1
dczepierga commentedIf i understand and see good, u have 2 modules where u call
hook_ckeditor_pluginwith this same name of plugin? U want add 2 times this same plugin or 2 diffrent plugins?Greetings
Comment #2
ruslan.muradov commentedYes I'm trying to add two different plugins, - I have two modules and in both of them are defined hook_ckeditor_plugin, BUT the names of plugins are different of course! Each of plugins (plugin.js) resides in its own subdirectory of corresponding module.
Here is the hooks definitions which I have wrote yesterday:
But, seems like your post gives me some suggestion. The string key on first level of every returned array should be the same as the name of plugin. i.e.
The sample of hook definition given in README.TXT is little bit ambiguous. Maybe sample will became more obvious if it will looks like
Thanks for your reply dczepierga! And thanks for a great module!
Comment #3
mkesicki commented@ruslan.muradov,
just to be sure , did you resolve you issue ?
If yes please close this issue.
Comment #4
ruslan.muradov commentedYes! Thanks to all of you for support!
Comment #5
mkesicki commentedComment #5.0
mkesicki commentedAdding the definition of hook