5 * Provide views data for book.module.
7 * @ingroup views_module_handlers
11 * Implements hook_views_data().
13 function book_views_data() {
16 $data['book']['table'] = [];
17 $data['book']['table']['group'] = t('Book');
19 $data['book']['table']['join'] = [
20 'node_field_data' => [
21 'left_field' => 'nid',
26 $data['book']['nid'] = [
28 'help' => t('The book page node.'),
30 'base' => 'node_field_data',
32 'label' => t('Book Page'),
36 $data['book']['bid'] = [
37 'title' => t('Top level book'),
38 'help' => t('The book the node is in.'),
40 'base' => 'node_field_data',
46 $data['book']['pid'] = [
47 'title' => t('Parent'),
48 'help' => t('The parent book node.'),
50 'base' => 'node_field_data',
52 'label' => t('Book Parent'),
56 $data['book']['has_children'] = [
57 'title' => t('Page has Children'),
58 'help' => t('Flag indicating whether this book page has children'),
67 'label' => t('Has Children'),
74 $data['book']['weight'] = [
75 'title' => t('Weight'),
76 'help' => t('The weight of the book page.'),
85 $data['book']['depth'] = [
86 'title' => t('Depth'),
87 'help' => t('The depth of the book page in the hierarchy; top level books have a depth of 1.'),
102 1 => t('1st parent'),
103 2 => t('2nd parent'),
104 3 => t('3rd parent'),
105 4 => t('4th parent'),
106 5 => t('5th parent'),
107 6 => t('6th parent'),
108 7 => t('7th parent'),
109 8 => t('8th parent'),
110 9 => t('9th parent'),
112 foreach ($parents as $i => $parent_label) {
113 $data['book']["p$i"] = [
114 'title' => $parent_label,
115 'help' => t('The @parent of book node.', ['@parent' => $parent_label]),
117 'base' => 'node_field_data',
119 'label' => t('Book @parent', ['@parent' => $parent_label]),