Drupal 7 Drupal钩子没有被调用
我是Drupal制作一个挂钩到ckeditor小部件的插件的新手。我完全不明白为什么我在ckeditor中定义的钩子的实现从未被调用 这里有一些细节Drupal 7 Drupal钩子没有被调用,drupal-7,ckeditor,hook,Drupal 7,Ckeditor,Hook,我是Drupal制作一个挂钩到ckeditor小部件的插件的新手。我完全不明白为什么我在ckeditor中定义的钩子的实现从未被调用 这里有一些细节 我的模块已启用 我可以使用更基本的钩子,比如exceltohtml\u插件,而不是exceltohtml\u ckeditor\u插件,并达到我的测试语句 很抱歉,我想不出更多的故障排除方法来揭示这个问题,因此非常感谢您的帮助 exceltohtml.module 如果模块中的函数是新的,则可能会缓存稍旧版本的模块代码 访问Drupal中的模块
- 我的模块已启用
- 我可以使用更基本的钩子,比如exceltohtml\u插件,而不是exceltohtml\u ckeditor\u插件,并达到我的测试语句李>
如果模块中的函数是新的,则可能会缓存稍旧版本的模块代码 访问Drupal中的模块列表页面,该页面应重新加载模块PHP代码:
admin/modules
在我的例子中,ckeditor模块非常旧。在干净的Drupal安装中使用此钩子安装新的ckeditor和新模块是可行的。这让我更新了我的ckeditor模块,它允许这个钩子出现。
<?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' ),
)
)
);
}
/**
* 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',
)
)
)
);
}