Add one field to hook__views_data()

prajila.v.p's picture

i am trying to develop a drupal module which wants a default view. Already there is a group called test which contain 2 fields. i want to add one more field to that group from my module. I tried this code. but it gives an array field and structure broken .

function myhook_views_data() {
$data['test']['table']['group'] = t('test');
$data['test']['table']['base'] = array(
'field' => 'view_name',
'title' => t('test data'),
'help' => t("test data help."),
'weight' => -10,
return $data;
how can i do this?? Pls help me


value of field

Rajesh Ashok's picture

You have used 'field' => 'view_name',

The value of field should contain the column name of your database table. Have u done the same ?

Value of field

prajila.v.p's picture

Yes. i have a field in database view_name which tracks the view name .

using views

sonofkc's picture

i never developed a module
but i think you can make a view using the views and export the view you created to module you wanted.
does it make sense.


Group organizers

Group events

Add to calendar

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week