5 * Provide views data and handlers for book.module.
7 * @ingroup views_module_handlers
11 * Implements hook_views_data().
13 function book_views_data() {
14 // ----------------------------------------------------------------------
17 $data['book']['table']['group'] = t('Book');
18 $data['book']['table']['join'] = array(
20 'left_field' => 'nid',
25 $data['book']['bid'] = array(
26 'title' => t('Top level book'),
27 'help' => t('The book the node is in.'),
28 'relationship' => array(
30 'handler' => 'views_handler_relationship',
33 // There is no argument here; if you need an argument, add the relationship
34 // and use the node: nid argument.
37 // ----------------------------------------------------------------------
38 // menu_links table -- this is aliased so we can get just book relations
40 // Book hierarchy and weight data are now in {menu_links}.
41 $data['book_menu_links']['table']['group'] = t('Book');
42 $data['book_menu_links']['table']['join'] = array(
44 'table' => 'menu_links',
45 'left_table' => 'book',
46 'left_field' => 'mlid',
51 $data['book_menu_links']['weight'] = array(
52 'title' => t('Weight'),
53 'help' => t('The weight of the book page.'),
55 'handler' => 'views_handler_field_numeric',
56 'click sortable' => TRUE,
59 'handler' => 'views_handler_sort',
63 $data['book_menu_links']['depth'] = array(
64 'title' => t('Depth'),
65 'help' => t('The depth of the book page in the hierarchy; top level books have a depth of 1.'),
67 'handler' => 'views_handler_field_numeric',
68 'click sortable' => TRUE,
71 'handler' => 'views_handler_sort',
74 'handler' => 'views_handler_filter_numeric',
77 'handler' => 'views_handler_argument',
81 $data['book_menu_links']['p'] = array(
82 'title' => t('Hierarchy'),
83 'help' => t('The order of pages in the book hierarchy.'),
85 'handler' => 'views_handler_sort_menu_hierarchy',
89 // ----------------------------------------------------------------------
90 // book_parent table -- this is an alias of the book table which
91 // represents the parent book.
93 // The {book} record for the parent node.
94 $data['book_parent']['table']['group'] = t('Book');
95 $data['book_parent']['table']['join'] = array(
98 'left_table' => 'book_menu_links',
99 'left_field' => 'plid',
104 $data['book_parent']['nid'] = array(
105 'title' => t('Parent'),
106 'help' => t('The parent book node.'),
107 'relationship' => array(
109 'base field' => 'nid',
110 'handler' => 'views_handler_relationship',
111 'label' => t('Book parent'),
119 * Implements hook_views_plugins().
121 function book_views_plugins() {
124 'argument default' => array(
125 'book_root' => array(
126 'title' => t('Book root from current node'),
127 'handler' => 'views_plugin_argument_default_book_root'