You are here

function entity_hierarchy_views_data in Entity Reference Hierarchy 8

Same name and namespace in other branches
  1. 8.2 entity_hierarchy.views.inc \entity_hierarchy_views_data()
  2. 3.x entity_hierarchy.views.inc \entity_hierarchy_views_data()

Implements hook_views_data().

File

./entity_hierarchy.views.inc, line 10
Views hooks for entity_hierarchy_views.

Code

function entity_hierarchy_views_data() {
  $data = array();
  $data['entity_hierarchy']['table']['group'] = t('Hierarchy');
  $data['entity_hierarchy']['table']['join'] = array(
    'node_field_data' => array(
      'left_field' => 'nid',
      'field' => 'cnid',
    ),
  );
  $data['entity_hierarchy']['cweight'] = array(
    'title' => t('Child Weight'),
    'help' => t('The sort order of the child node.'),
    'field' => array(
      'id' => 'numeric',
    ),
    'sort' => array(
      'id' => 'standard',
    ),
  );
  $data['entity_hierarchy']['pnid'] = array(
    'title' => t('Parent Node ID'),
    'help' => t('The parent id of the node.'),
    // Information for accepting a parent as an argument.
    'argument' => array(
      'field' => 'pnid',
      'id' => 'numeric',
    ),
    'relationship' => array(
      'base' => 'node_field_data',
      'base field' => 'nid',
      'field' => 'pnid',
      'id' => 'standard',
      'label' => t('Parent Node'),
    ),
  );
  return $data;
}