1
votes

I mean to have custom date handler in views ,according to documentation of views i should implement hook_views_api and hook_views_data .

my pseudo

 function mymodule_views_api() {
  return array(
 'api' => views_api_version(),
 );
 }

and in hook_views_data()

function mymodule_views_data() {
  $data = array();
  $data['node']['created'] = array(
 'group' => t('Mul2'),
'title' => t('Post date'), // The item it appears as on the UI,
'help' => t('The date the content was posted.'), // The help that appears on the UI,
'field' => array(
  'handler' => 'views_handler_field_date',
  'click sortable' => TRUE,
),
'sort' => array(
  'handler' => 'views_handler_sort_date',
),
'filter' => array(
  'handler' => 'views_handler_filter_date',
),
);
return $data;

}

It's ok and create a views field gorup (Mul2), enter image description here I set it hanlder date handler for test, but it not work correctly and just show Mul2: Array , and broken/missing handler in configuration of it.

I try successfully get data of custom table with views data .Is it correct to set handler for a field before handlered (like created in node ) ? any solution?any idea?

1

1 Answers

2
votes

Method of Impelementation is correct, my mistake was in use a field that before set handler for it $data['node']['created'] . if you want to change default handler of handled field you have use hook_views_data_alter(&$data) instead of try to set handler for it again!!!(Mul2:array because of you try to set handler for handled field).