drupal - Can't create custom handler for Views2 -
basically want create custom handler unserialize db field called birthday.
i've managed correctly output field serialized using default views_handler_field. unfortunately when try create custom handler, message:
error: handler drappsprofiles > birthday doesn't exist!
here's file structure:
all/modules/drapps/drappsprofile/ |->drappsprofiles.views.inc |->drappsprofiles.module |->drappsprofiles.install |->drappsprofiles.info |->drappsprofiles.inc |->drappsprofiles_handler_field_birthday.inc
here's 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'); (...)
here's 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; }
drappsprofiles_handler_field_birthday.inc
<?php /** * * custom views handler birthday * */ class drappsprofiles_handler_field_birthday extends views_handler_field { function render($values) { $val = unserialize($values->{$this->field_alias}); return ($val); } }
it seems drappsprofiles_handler_field_birthday.inc not being read, although can't figure out why.
any appreciated. (i've been around 2 weeks!)
assuming (...) in .views.inc conceals code like:
$data['drappsprofiles']['table']['group'] = t('drappsprofiles'); $data['drappsprofiles']['table']['base'] = array( 'field' => 'birthday', ); $data['drappsprofiles']['table']['join'] = array( '#global' => array(), );
which assuming since field has group select can missing handler..
then next thing @ still in .views.inc in module_views_handlers() { :
return array( ++ 'info' => array( ++ 'path' => drupal_get_path('module','drappsprofilse'), ++ ), 'handlers' => array(
and beyond that, hate it, uninstalling , reinstalling module apparently refreshes recent code tweaks .views.inc .. know had bunch of times, noticed too.
Comments
Post a Comment