tripal_ds.module 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. require_once "includes/tripal_ds.inc";
  3. require_once "includes/tripal_ds.ds.inc";
  4. require_once "includes/tripal_ds.field_group.inc";
  5. require_once "includes/tripal_ds.field_formatter.inc";
  6. function tripal_ds_init() {
  7. drupal_add_css(drupal_get_path('module', 'tripal_ds') . '/theme/css/tripaldsfeature.css');
  8. drupal_add_js(drupal_get_path('module', 'tripal_ds') . '/theme/js/tripal_ds.js');
  9. $theme_dir = url(drupal_get_path('module', 'tripal_ds') . '/theme');
  10. drupal_add_js("var ds_theme_dir = '$theme_dir';", 'inline', 'header');
  11. }
  12. /**
  13. * Implements hook_views_api().
  14. */
  15. function tripal_ds_views_api() {
  16. return array(
  17. 'api' => 3,
  18. 'path' => drupal_get_path('module', 'tripal_ds') . '/includes/views',
  19. );
  20. }
  21. /*
  22. * Implements hook_ds_layout_info() to define layouts from code in a module for
  23. * display suite
  24. function tripal_ds_ds_layout_info() {
  25. $path = drupal_get_path('module', 'tripal_ds');
  26. $layouts = array(
  27. 'tripal_ds_feature' => array(
  28. 'label' => t('Tripal Feature Layout'),
  29. 'path' => $path . '/theme/templates',
  30. 'regions' => array(
  31. 'top' => t('Top'),
  32. 'left' => t('Left'),
  33. 'right' => t('Right'),
  34. 'bottom' => t('Bottom'),
  35. ),
  36. 'css' => TRUE,
  37. ),
  38. );
  39. return $layouts;
  40. }
  41. */
  42. /**
  43. * Implements hook_bundle_postcreate().
  44. *
  45. * This is a Triapl defined hook and is called in the TripalBundle::create()
  46. * function to allow modules to perform tasks when a bundle is created.
  47. */
  48. function tripal_ds_bundle_postcreate($bundle) {
  49. $bundle_name = $bundle->name;
  50. $instances = field_info_instances('TripalEntity', $bundle_name);
  51. _ds_layout_settings_info($bundle_name, $instances);
  52. }
  53. /*
  54. * Code for the view of the menu items
  55. //get tripal entity id from url then run it against tripal entity db
  56. //and grab the bundle id, then pass bundle id to view
  57. $url = current_path();
  58. $url_exploded = explode("/", $url);
  59. $tripal_entity_id = (int)$url_exploded[1];
  60. $result = db_select('tripal_entity', 'te')
  61. ->fields('te', array('bundle'))
  62. ->condition('id', $tripal_entity_id, '=')
  63. ->execute()
  64. ->fetchField();
  65. */