nodequeue.views_default.inc 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <?php
  2. /**
  3. * @file
  4. * Default views for nodequeue. This modifies an exported view; it might
  5. * actually work better to create the view dynamically. It would be less
  6. * code and more modifiable later.
  7. */
  8. function nodequeue_views_default_views() {
  9. $views = array();
  10. if (variable_get('nodequeue_view_per_queue', 1) != 1) {
  11. return $views;
  12. }
  13. $queues = nodequeue_load_queues(nodequeue_get_all_qids());
  14. foreach ($queues as $queue) {
  15. $view = new view;
  16. $view->name = "nodequeue_$queue->qid";
  17. $view->description = t("Display a list of all nodes in queue '@queue'", array('@queue' => $queue->title));
  18. $view->tag = t('nodequeue');
  19. $view->view_php = '';
  20. $view->base_table = 'node';
  21. $view->is_cacheable = '0';
  22. $view->api_version = 2;
  23. $view->disabled = FALSE; // Edit this to true to make a default view disabled initially
  24. $view->display = array();
  25. $display = new views_display;
  26. $display->id = 'default';
  27. $display->display_title = t('Defaults');
  28. $display->display_plugin = 'default';
  29. $display->position = '1';
  30. $display->display_options = array(
  31. 'style_plugin' => 'default',
  32. 'style_options' => array(),
  33. 'row_plugin' => 'node',
  34. 'row_options' => array(
  35. 'teaser' => 1,
  36. 'links' => 1,
  37. ),
  38. 'relationships' => array(
  39. 'nodequeue_rel' => array(
  40. 'id' => 'nodequeue_rel',
  41. 'table' => 'node',
  42. 'field' => 'nodequeue_rel',
  43. 'label' => 'queue',
  44. 'required' => 1,
  45. 'limit' => TRUE,
  46. 'qids' => array($queue->qid => $queue->qid),
  47. 'relationship' => 'none',
  48. ),
  49. ),
  50. 'fields' => array(
  51. 'title' => array(
  52. 'id' => 'title',
  53. 'table' => 'node',
  54. 'field' => 'title',
  55. 'label' => '',
  56. 'relationship' => 'none',
  57. 'link_to_node' => 1,
  58. ),
  59. ),
  60. 'sorts' => array(
  61. 'position' => array(
  62. 'id' => 'position',
  63. 'table' => 'nodequeue_nodes',
  64. 'field' => 'position',
  65. 'order' => 'ASC',
  66. 'relationship' => 'nodequeue_rel',
  67. ),
  68. ),
  69. 'arguments' => array(),
  70. 'filters' => array(
  71. 'status_extra' => array(
  72. 'id' => 'status_extra',
  73. 'table' => 'node',
  74. 'field' => 'status_extra',
  75. 'operator' => '=',
  76. 'value' => '',
  77. 'group' => 0,
  78. 'exposed' => FALSE,
  79. 'expose' => array(
  80. 'operator' => FALSE,
  81. 'label' => '',
  82. ),
  83. 'relationship' => 'none',
  84. ),
  85. ),
  86. 'items_per_page' => 10,
  87. 'use_pager' => '1',
  88. 'pager_element' => 0,
  89. 'title' => t("Queue '@queue'", array('@queue' => $queue->title)),
  90. 'use_more' => 1,
  91. );
  92. $view->display['default'] = $display;
  93. $display = new views_display;
  94. $display->id = 'page';
  95. $display->display_title = t('Page');
  96. $display->display_plugin = 'page';
  97. $display->position = '2';
  98. $display->display_options = array(
  99. 'defaults' => array(
  100. 'access' => TRUE,
  101. 'title' => TRUE,
  102. 'header' => TRUE,
  103. 'header_format' => TRUE,
  104. 'header_empty' => TRUE,
  105. 'footer' => TRUE,
  106. 'footer_format' => TRUE,
  107. 'footer_empty' => TRUE,
  108. 'empty' => TRUE,
  109. 'empty_format' => TRUE,
  110. 'use_ajax' => TRUE,
  111. 'items_per_page' => TRUE,
  112. 'offset' => TRUE,
  113. 'use_pager' => TRUE,
  114. 'pager_element' => TRUE,
  115. 'use_more' => TRUE,
  116. 'distinct' => TRUE,
  117. 'link_display' => TRUE,
  118. 'style_plugin' => TRUE,
  119. 'style_options' => TRUE,
  120. 'row_plugin' => TRUE,
  121. 'row_options' => TRUE,
  122. 'relationships' => TRUE,
  123. 'fields' => TRUE,
  124. 'sorts' => TRUE,
  125. 'arguments' => TRUE,
  126. 'filters' => TRUE,
  127. ),
  128. 'relationships' => array(),
  129. 'fields' => array(),
  130. 'sorts' => array(),
  131. 'arguments' => array(),
  132. 'filters' => array(),
  133. 'path' => "nodequeue/$queue->qid",
  134. );
  135. $view->display['page'] = $display;
  136. $display = new views_display;
  137. $display->id = 'block';
  138. $display->display_title = t('Block');
  139. $display->display_plugin = 'block';
  140. $display->position = '3';
  141. $display->display_options = array(
  142. 'defaults' => array(
  143. 'access' => TRUE,
  144. 'title' => TRUE,
  145. 'header' => TRUE,
  146. 'header_format' => TRUE,
  147. 'header_empty' => TRUE,
  148. 'footer' => TRUE,
  149. 'footer_format' => TRUE,
  150. 'footer_empty' => TRUE,
  151. 'empty' => TRUE,
  152. 'empty_format' => TRUE,
  153. 'use_ajax' => TRUE,
  154. 'items_per_page' => FALSE,
  155. 'offset' => FALSE,
  156. 'use_pager' => FALSE,
  157. 'pager_element' => FALSE,
  158. 'use_more' => TRUE,
  159. 'distinct' => TRUE,
  160. 'link_display' => TRUE,
  161. 'style_plugin' => FALSE,
  162. 'style_options' => FALSE,
  163. 'row_plugin' => FALSE,
  164. 'row_options' => FALSE,
  165. 'relationships' => TRUE,
  166. 'fields' => TRUE,
  167. 'sorts' => TRUE,
  168. 'arguments' => TRUE,
  169. 'filters' => TRUE,
  170. ),
  171. 'relationships' => array(),
  172. 'fields' => array(),
  173. 'sorts' => array(),
  174. 'arguments' => array(),
  175. 'filters' => array(),
  176. 'style_plugin' => 'list',
  177. 'style_options' => array(
  178. 'type' => 'ul',
  179. ),
  180. 'row_plugin' => 'fields',
  181. 'row_options' => array(
  182. 'inline' => array(),
  183. 'separator' => '',
  184. ),
  185. 'block_description' => t("Queue '@queue'", array('@queue' => $queue->title)),
  186. 'items_per_page' => 5,
  187. 'offset' => 0,
  188. 'use_pager' => '0',
  189. 'pager_element' => 0,
  190. );
  191. $view->display['block'] = $display;
  192. $views[$view->name] = $view;
  193. }
  194. return $views;
  195. }