1
votes

I'm new to Drupal making a plugin that hooks into the ckeditor widget. I absolutely can't figure out why my implementation of a hook that is defined in ckeditor is never called.

Here are some details

  • my module is enabled
  • I'm able to use more basic hooks like exceltohtml_plugin instead of exceltohtml_ckeditor_plugin and reach my test statement.

I'm can't think of any more troubleshooting ideas to reveal the issue so any help would be greatly appreciated.

exceltohtml.module

    <?php
    error_log("TEST: this will print to log");

    // implementation of hook_ckeditor_plugin()
    function exceltohtml_ckeditor_plugin()
    {
        error_log("TEST: but this will never run");

        return array(
            'exceltohtml' => array(
                'name' => 'exceltohtml',
                'desc' => t('Excel sheet upload'),
                'path' =>  drupal_get_path('module', 'exceltohtml')  .'/plugins/exceltohtml',
                'buttons' => array(
                    'excel_to_html' => array('label' => 'Insert spoiler','icon' => '/images/image.gif' ),
                    )
                )


      );
}

ckeditor.api.php (the file in ckeditor that Im basing my hook on)

/**
 * Hook to register the CKEditor plugin 
 */
function hook_ckeditor_plugin() {
  return array(
    'plugin_name' => array(
      // Name of the plugin used to write it.
      'name' => 'plugin_name',
      // Description of the plugin - it would be displayed in the plugins management section of profile settings.
      'desc' => t('Plugin description'),
      // The full path to the CKEditor plugins directory, with the trailing slash.
      'path' => drupal_get_path('module', 'my_module') . '/plugin_dir/',
      'buttons' => array(
        'button_name' => array(
          'icon' => 'path to button icon',
          'label' => 'Button Label',
        )
      )
    )
  );
}
1

1 Answers

1
votes

If the function in your module is new, then the slightly older version of your module code might be cached.

Visit the module listing page in Drupal, that should reload the modules PHP code:

admin/modules