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'),
              ...
            )
        )
    );
}
CommentFileSizeAuthor
cke_issue_attachment.png41.07 KBruslan.muradov

Comments

ruslan.muradov’s picture

Issue summary: View changes

update to description of the task

dczepierga’s picture

Status: Active » Postponed (maintainer needs more info)

If i understand and see good, u have 2 modules where u call hook_ckeditor_plugin with this same name of plugin? U want add 2 times this same plugin or 2 diffrent plugins?

Greetings

ruslan.muradov’s picture

U want add 2 times this same plugin or 2 diffrent plugins?

Yes 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:

function MODULENAME_1_ckeditor_plugin() {
  return array(
        'plugin_name' => array(
            // Plugin name.
            'name' => 'plugin_name_1',
            ...
        )
    );
}
function MODULENAME_2_ckeditor_plugin() {
  return array(
        'plugin_name' => array(
            // Plugin name.
            'name' => 'plugin_name_2',
            ...
        )
    );
}

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.

function MODULENAME_2_ckeditor_plugin() {
  return array(
        'plugin_name_2' => array(
            // Plugin name.
            'name' => 'plugin_name_2',
            ...
        )
    );
}

The sample of hook definition given in README.TXT is little bit ambiguous. Maybe sample will became more obvious if it will looks like

function MODULENAME_ckeditor_plugin() {
  return array(
        'name_of_your_plugin' => array(
            // Plugin name.
            'name' => 'name_of_your_plugin',
            ...
        )
    );
}

Thanks for your reply dczepierga! And thanks for a great module!

mkesicki’s picture

@ruslan.muradov,
just to be sure , did you resolve you issue ?
If yes please close this issue.

ruslan.muradov’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

just to be sure , did you resolve you issue ?

Yes! Thanks to all of you for support!

mkesicki’s picture

Category: bug » support
mkesicki’s picture

Issue summary: View changes

Adding the definition of hook