tripal_ds.views_default.inc 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /**
  3. * Implements hook_views_default_views().
  4. */
  5. function tripal_ds_views_default_views() {
  6. $view = new view();
  7. $view->name = 'tripal_content_type_toc';
  8. $view->description = '';
  9. $view->tag = 'default';
  10. $view->base_table = 'tripal_ds';
  11. $view->human_name = 'Tripal Content Type Table of Contents';
  12. $view->core = 7;
  13. $view->api_version = '3.0';
  14. $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  15. /* Display: Master */
  16. $handler = $view->new_display('default', 'Master', 'default');
  17. $handler->display->display_options['title'] = 'Table of Contents';
  18. $handler->display->display_options['use_more_always'] = FALSE;
  19. $handler->display->display_options['access']['type'] = 'none';
  20. $handler->display->display_options['cache']['type'] = 'none';
  21. $handler->display->display_options['query']['type'] = 'views_query';
  22. $handler->display->display_options['exposed_form']['type'] = 'basic';
  23. $handler->display->display_options['pager']['type'] = 'full';
  24. $handler->display->display_options['pager']['options']['items_per_page'] = '10';
  25. $handler->display->display_options['style_plugin'] = 'default';
  26. $handler->display->display_options['row_plugin'] = 'fields';
  27. /* Field: Tripal Panes: Field Name */
  28. $handler->display->display_options['fields']['tripal_ds_field_name']['id'] = 'tripal_ds_field_name';
  29. $handler->display->display_options['fields']['tripal_ds_field_name']['table'] = 'tripal_ds';
  30. $handler->display->display_options['fields']['tripal_ds_field_name']['field'] = 'tripal_ds_field_name';
  31. $handler->display->display_options['fields']['tripal_ds_field_name']['label'] = '';
  32. $handler->display->display_options['fields']['tripal_ds_field_name']['exclude'] = TRUE;
  33. $handler->display->display_options['fields']['tripal_ds_field_name']['element_label_colon'] = FALSE;
  34. /* Field: Tripal Panes: Bundle ID */
  35. $handler->display->display_options['fields']['bundle']['id'] = 'bundle';
  36. $handler->display->display_options['fields']['bundle']['table'] = 'tripal_ds';
  37. $handler->display->display_options['fields']['bundle']['field'] = 'bundle';
  38. $handler->display->display_options['fields']['bundle']['label'] = '';
  39. $handler->display->display_options['fields']['bundle']['exclude'] = TRUE;
  40. $handler->display->display_options['fields']['bundle']['element_label_colon'] = FALSE;
  41. /* Field: Tripal Panes: Field Label */
  42. $handler->display->display_options['fields']['tripal_ds_field_label']['id'] = 'tripal_ds_field_label';
  43. $handler->display->display_options['fields']['tripal_ds_field_label']['table'] = 'tripal_ds';
  44. $handler->display->display_options['fields']['tripal_ds_field_label']['field'] = 'tripal_ds_field_label';
  45. $handler->display->display_options['fields']['tripal_ds_field_label']['label'] = '';
  46. $handler->display->display_options['fields']['tripal_ds_field_label']['alter']['alter_text'] = TRUE;
  47. $handler->display->display_options['fields']['tripal_ds_field_label']['alter']['text'] = '<a href="#" class="tripal_pane-toc-list-item-link" id ="[tripal_ds_field_name]">[tripal_ds_field_label] </a>';
  48. $handler->display->display_options['fields']['tripal_ds_field_label']['element_label_colon'] = FALSE;
  49. /* Sort criterion: Tripal Panes: Weight */
  50. $handler->display->display_options['sorts']['weight']['id'] = 'weight';
  51. $handler->display->display_options['sorts']['weight']['table'] = 'tripal_ds';
  52. $handler->display->display_options['sorts']['weight']['field'] = 'weight';
  53. /* Contextual filter: Tripal Panes: Bundle ID */
  54. $handler->display->display_options['arguments']['bundle']['id'] = 'bundle';
  55. $handler->display->display_options['arguments']['bundle']['table'] = 'tripal_ds';
  56. $handler->display->display_options['arguments']['bundle']['field'] = 'bundle';
  57. $handler->display->display_options['arguments']['bundle']['default_action'] = 'default';
  58. $handler->display->display_options['arguments']['bundle']['default_argument_type'] = 'php';
  59. $handler->display->display_options['arguments']['bundle']['default_argument_options']['code'] = '$url = current_path();
  60. $url_exploded = explode("/", $url);
  61. $tripal_entity_id = (int)$url_exploded[1];
  62. $result = db_select(\'tripal_entity\', \'te\')
  63. ->fields(\'te\', array(\'bundle\'))
  64. ->condition(\'id\', $tripal_entity_id, \'=\')
  65. ->execute()
  66. ->fetchField();
  67. return $result;';
  68. $handler->display->display_options['arguments']['bundle']['summary']['number_of_records'] = '0';
  69. $handler->display->display_options['arguments']['bundle']['summary']['format'] = 'default_summary';
  70. $handler->display->display_options['arguments']['bundle']['summary_options']['items_per_page'] = '25';
  71. $handler->display->display_options['arguments']['bundle']['limit'] = '0';
  72. /* Display: Page */
  73. $handler = $view->new_display('page', 'Page', 'page');
  74. $handler->display->display_options['path'] = 'tripal_ct_toc';
  75. /* Display: Block */
  76. $handler = $view->new_display('block', 'Block', 'block');
  77. $handler->display->display_options['defaults']['pager'] = FALSE;
  78. $handler->display->display_options['pager']['type'] = 'none';
  79. $handler->display->display_options['pager']['options']['offset'] = '0';
  80. $views[$view->name] = $view;
  81. // Return views.
  82. return $views;
  83. }