You are here

function nodehierarchy_views_data in Node Hierarchy 7.4

Same name and namespace in other branches
  1. 6.3 includes/views/nodehierarchy.views.inc \nodehierarchy_views_data()
  2. 6.2 includes/views/nodehierarchy.views.inc \nodehierarchy_views_data()
  3. 7.2 includes/views/nodehierarchy.views.inc \nodehierarchy_views_data()

Implements hook_views_data().

File

includes/views/nodehierarchy.views.inc, line 32
Implementations of Views 2 Hooks for nodehierarchy_views module

Code

function nodehierarchy_views_data() {

  // Basic table information.
  $data['nodehierarchy']['table']['group'] = t('Node Hierarchy');
  $data['nodehierarchy']['table']['join'] = array(
    'node' => array(
      'left_field' => 'nid',
      'field' => 'cnid',
    ),
  );
  $data['nodehierarchy']['cweight'] = array(
    'title' => t('Child Weight'),
    'help' => t('The sort order of the child node.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['nodehierarchy']['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',
      'handler' => 'views_handler_argument_node_nid',
      'click sortable' => TRUE,
    ),
    'relationship' => array(
      'base' => 'node',
      'base field' => 'nid',
      'field' => 'pnid',
      'handler' => 'views_handler_relationship',
      'label' => t('Parent Node'),
    ),
  );
  return $data;
}