I'm quite new in Drupal and need somme help with my custom table view. I declared a base table (primary key id) in hook_data_view and want to see the fields in views module. But by any reason it comes up only, if I put in a join to node I don't want. How can I get rid of it?

$data['image_room_image']['table']['group'] = t('Image Room');
$data['image_room_image']['table']['base'] = array(
'field' => 'id',
'title' => t('Example table'),
'help' => t("Example table contains example content and can be related to nodes."),
'weight' => -10,
);
$data['image_room_image']['table']['join'] = array(
'node' => array(
'left_field' => 'nid',
'field' => 'id',
),
);
$data['image_room_image']['filename'] = array(
'title' => t('Plain text field'),
'help' => t('Just a plain text field.'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
);

Comments

jdubbwya’s picture

$data['image_room_image']['table']['group'] = t('Image Room');
$data['image_room_image']['table']['base'] = array(
'field' => 'id',
'title' => t('Example table'),
'help' => t("Example table contains example content and can be related to nodes."),
'weight' => -10,
);
$data['image_room_image']['id'] = array(
'title' => t('Plain text field'),
'help' => t('Just a plain text field.'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
);
BeyersdorferTJ’s picture

This code fix don't change anything. The field id still doesn't show up in views field list.

Can anybody help me?

  $data['rr_idx_collection']['table']['group'] = t('ReadingRoom');
  $data['rr_idx_collection']['table']['base'] = array(
    'field' => 'id',
    'title' => t('Example table'),
    'help' => t("Example text."),
  );
  $data['rr_idx_collection']['id'] = array(
    'title' => t('Plain text field'),
    'help' => t('Just a plain text field.'),
    'field' => array('handler' => 'views_handler_field','click sortable' => TRUE,),
    'sort' => array('handler' => 'views_handler_sort',),
    'filter' => array('handler' => 'views_handler_filter_string',),
    'argument' => array('handler' => 'views_handler_argument_string',),
  );
  return $data;