我的hook_views_handlers()沒有被調用。我嘗試清除緩存,重新安裝模塊等等。我添加了watchdog()調用來查看它是否被調用,並且它從來沒有。hook_views_handlers沒有被調用
該領域暴露出與同類型代碼視圖計數器的計用途:
我可以將字段添加到視圖,但一旦我添加它,它只是顯示爲「破碎/失蹤」
這三個文件都位於funwithviews模塊目錄的根目錄中。這是相關代碼。
有什麼看起來不合適的地方?
這存在於:funwithviews.module
/**
* Implements hook_views_api().
*/
function funwithviews_views_api() {
return array(
'api' => 3.0
);
}
這存在於:funwithviews.views.inc
/**
* Implementation of hook_views_data()
*/
function funwithviews_views_data() {
$data['fwv']['table']['group'] = t('FunSpace');
$data['fwv']['table']['join'] = array(
'#global' => array(),
);
$data['fwv']['counter'] = array(
'title' => t('Fun counter'),
'help' => t('This counter is more fun than the other one.'),
'field' => array(
'handler' => 'funwithviews_handler_field_fwv_counter',
),
);
return $data;
}
/**
* Implements of hook_views_handlers().
*/
function funwithviews_views_handlers() {
return array(
'info' => array(
'path' => drupal_get_path('module', 'funwithviews'),
),
'handlers' => array(
'funwithviews_handler_field_fwv_counter' => array(
'parent' => 'views_handler_field',
),
),
);
}
這存在於:funwithviews_handler_field_fwv_counter.inc
class funwithviews_handler_field_fwv_counter extends views_handler_field {
查看https://drupal.org/node/856186 – 2013-09-16 04:52:37