View source
<?php
function nodehierarchy_views_handlers() {
return array(
'info' => array(
'path' => drupal_get_path('module', 'nodehierarchy') . '/includes/views',
),
'handlers' => array(
'views_handler_field_nodehierarchy_actions' => array(
'parent' => 'views_handler_field',
),
'views_handler_field_nodehierarchy_parent' => array(
'parent' => 'views_handler_field',
),
'views_handler_argument_nodehierarchy_ancestor' => array(
'parent' => 'views_handler_argument',
),
),
);
}
function nodehierarchy_views_views_data() {
$data['nodehierarchy']['table']['group'] = t('Node Hierarchy');
$data['nodehierarchy']['table']['join'] = array(
'node' => array(
'handler' => 'views_join',
'arguments' => array(
'nodehierarchy',
'node',
'nid',
'nid',
),
),
);
$data['nodehierarchy']['parent'] = array(
'title' => t('Parent Node'),
'help' => t('The parent id of the node.'),
'field' => array(
'handler' => 'views_handler_field_nodehierarchy_parent',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_node_nid',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_equality',
),
);
$data['nodehierarchy']['order_by'] = array(
'title' => t('Child Sort Order'),
'help' => t('The assigned order of the node relative to it\'s siblings.'),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['nodehierarchy']['antecedent'] = array(
'title' => t('Ancestor Node ID'),
'help' => t('Use this if you want to display any descendant of the given node'),
'argument' => array(
'handler' => 'views_handler_argument_nodehierarchy_ancestor',
),
);
$data['nodehierarchy']['actions'] = array(
'title' => t('Actions'),
'help' => t('Edit, view and reorder actions'),
'field' => array(
'field' => 'nid',
'group' => t('Node Hierarchy'),
'handler' => 'views_handler_field_nodehierarchy_actions',
'click sortable' => FALSE,
),
);
return $data;
}