Drupal 无法为Views2创建自定义处理程序
基本上,我想创建一个自定义处理程序来取消序列化名为birthday的db字段 我已经成功地使用默认的views\u handler\u字段正确地输出了序列化的字段。不幸的是,当我尝试创建自定义处理程序时,收到以下消息: 错误:drappsprofiles>生日的处理程序不存在 以下是文件结构:Drupal 无法为Views2创建自定义处理程序,drupal,drupal-modules,views2,Drupal,Drupal Modules,Views2,基本上,我想创建一个自定义处理程序来取消序列化名为birthday的db字段 我已经成功地使用默认的views\u handler\u字段正确地输出了序列化的字段。不幸的是,当我尝试创建自定义处理程序时,收到以下消息: 错误:drappsprofiles>生日的处理程序不存在 以下是文件结构: all/modules/drapps/drappsprofile/ |->drappsprofiles.views.inc |->drappsprofiles.module |-&
all/modules/drapps/drappsprofile/
|->drappsprofiles.views.inc
|->drappsprofiles.module
|->drappsprofiles.install
|->drappsprofiles.info
|->drappsprofiles.inc
|->drappsprofiles_handler_field_birthday.inc
这是drappsprofiles.module
/**
* VIEWS2 MODULE
* Implementation hook_views_api
**/
function drappsprofiles_views_api() {
$info['api'] = 2;
return $info;
}
/*****************************************************************************
* INCLUDES
**/
// Loads Google Apps Profile Integration
module_load_include('inc', 'drappsprofiles');
(...)
这里是drappsprofiles.views.inc
/**
*
* Implementation of hook_views_handlers().
*
**/
function drappsprofiles_views_handlers() {
return array(
'handlers' => array(
'drappsprofiles_handler_field_birthday' => array(
'parent' => 'views_handler_field',
)
)
);
}
/**
* Implementation of hook_views_data().
*
* @return array
**/
function drappsprofiles_views_data() {
(...)
$data['drappsprofiles']['birthday'] = array(
'title' => t('Birthday'),
'help' => t('Users birthday'),
'field' => array(
'handler' => 'drappsprofiles_handler_field_birthday',
'click sortable' => FALSE,
),
);
return $data;
}
德拉普档案公司
<?php
/**
*
* Custom views handler for Birthday
*
*/
class drappsprofiles_handler_field_birthday extends views_handler_field {
function render($values) {
$val = unserialize($values->{$this->field_alias});
return ($val);
}
}
看起来drappsprofiles\u handler\u field\u birthday.inc没有被读取,尽管我不知道为什么
任何帮助都将不胜感激。我已经做了两周了 假设你。。。in.views.inc隐藏的代码如下:
$data['drappsprofiles']['table']['group'] = t('drappsprofiles');
$data['drappsprofiles']['table']['base'] = array(
'field' => 'birthday',
);
$data['drappsprofiles']['table']['join'] = array(
'#global' => array(),
);
我假设是这样的,因为您的字段有一个组可以从中选择它,以便它可以查找缺少的处理程序
接下来要查看的内容仍然是模块_views_handlers{:
return array(
++ 'info' => array(
++ 'path' => drupal_get_path('module','drappsprofilse'),
++ ),
'handlers' => array(
除此之外,我不想这么说,但卸载和重新安装模块显然会刷新.views.inc.最近的代码调整。我知道我已经做了很多次了,你可能也注意到了这一点。谢谢你的回答。不久前,我按照你的建议通过卸载和重新安装解决了这个问题。虽然有些奇怪,但效果不错。