book.views.inc

  1. cis7 sites/all/modules/ulmus/views/modules/book.views.inc
  2. cle7 sites/all/modules/ulmus/views/modules/book.views.inc
  3. ecd7 sites/all/modules/ulmus/views/modules/book.views.inc
  4. elmsmedia7 sites/all/modules/ulmus/views/modules/book.views.inc
  5. harmony7 sites/all/modules/ulmus/views/modules/book.views.inc
  6. icor7 sites/all/modules/ulmus/views/modules/book.views.inc
  7. meedjum_blog7 sites/all/modules/ulmus/views/modules/book.views.inc
  8. mooc7 sites/all/modules/ulmus/views/modules/book.views.inc

Provide views data and handlers for book.module.

Functions

File

sites/all/modules/ulmus/views/modules/book.views.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Provide views data and handlers for book.module.
  5. *
  6. * @ingroup views_module_handlers
  7. */
  8. /**
  9. * Implements hook_views_data().
  10. */
  11. function book_views_data() {
  12. // ----------------------------------------------------------------------
  13. // book table
  14. $data['book']['table']['group'] = t('Book');
  15. $data['book']['table']['join'] = array(
  16. 'node' => array(
  17. 'left_field' => 'nid',
  18. 'field' => 'nid',
  19. ),
  20. );
  21. $data['book']['bid'] = array(
  22. 'title' => t('Top level book'),
  23. 'help' => t('The book the node is in.'),
  24. 'relationship' => array(
  25. 'base' => 'node',
  26. 'handler' => 'views_handler_relationship',
  27. 'label' => t('Book'),
  28. ),
  29. // There is no argument here; if you need an argument, add the relationship
  30. // and use the node: nid argument.
  31. );
  32. // ----------------------------------------------------------------------
  33. // menu_links table -- this is aliased so we can get just book relations
  34. // Book hierarchy and weight data are now in {menu_links}.
  35. $data['book_menu_links']['table']['group'] = t('Book');
  36. $data['book_menu_links']['table']['join'] = array(
  37. 'node' => array(
  38. 'table' => 'menu_links',
  39. 'left_table' => 'book',
  40. 'left_field' => 'mlid',
  41. 'field' => 'mlid',
  42. ),
  43. );
  44. $data['book_menu_links']['weight'] = array(
  45. 'title' => t('Weight'),
  46. 'help' => t('The weight of the book page.'),
  47. 'field' => array(
  48. 'handler' => 'views_handler_field_numeric',
  49. 'click sortable' => TRUE,
  50. ),
  51. 'sort' => array(
  52. 'handler' => 'views_handler_sort',
  53. ),
  54. );
  55. $data['book_menu_links']['depth'] = array(
  56. 'title' => t('Depth'),
  57. 'help' => t('The depth of the book page in the hierarchy; top level books have a depth of 1.'),
  58. 'field' => array(
  59. 'handler' => 'views_handler_field_numeric',
  60. 'click sortable' => TRUE,
  61. ),
  62. 'sort' => array(
  63. 'handler' => 'views_handler_sort',
  64. ),
  65. 'filter' => array(
  66. 'handler' => 'views_handler_filter_numeric',
  67. ),
  68. 'argument' => array(
  69. 'handler' => 'views_handler_argument',
  70. ),
  71. );
  72. $data['book_menu_links']['p'] = array(
  73. 'title' => t('Hierarchy'),
  74. 'help' => t('The order of pages in the book hierarchy.'),
  75. 'sort' => array(
  76. 'handler' => 'views_handler_sort_menu_hierarchy',
  77. ),
  78. );
  79. // ----------------------------------------------------------------------
  80. // book_parent table -- this is an alias of the book table which
  81. // represents the parent book.
  82. // The {book} record for the parent node.
  83. $data['book_parent']['table']['group'] = t('Book');
  84. $data['book_parent']['table']['join'] = array(
  85. 'node' => array(
  86. 'table' => 'book',
  87. 'left_table' => 'book_menu_links',
  88. 'left_field' => 'plid',
  89. 'field' => 'mlid',
  90. ),
  91. );
  92. $data['book_parent']['nid'] = array(
  93. 'title' => t('Parent'),
  94. 'help' => t('The parent book node.'),
  95. 'relationship' => array(
  96. 'base' => 'node',
  97. 'base field' => 'nid',
  98. 'handler' => 'views_handler_relationship',
  99. 'label' => t('Book parent'),
  100. ),
  101. );
  102. return $data;
  103. }
  104. /**
  105. * Implements hook_views_plugins().
  106. */
  107. function book_views_plugins() {
  108. return array(
  109. 'module' => 'views',
  110. 'argument default' => array(
  111. 'book_root' => array(
  112. 'title' => t('Book root from current node'),
  113. 'handler' => 'views_plugin_argument_default_book_root'
  114. ),
  115. ),
  116. );
  117. }

Related topics