tripal_ds.module 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. function tripal_ds_init() {
  6. drupal_add_css(drupal_get_path('module', 'tripal_ds') . '/theme/css/tripaldsfeature.css');
  7. drupal_add_css(drupal_get_path('module', 'tripal_ds') . '/theme/css/bootstrap.css');
  8. }
  9. /**
  10. * Implements hook_ds_layout_info() to define layouts from code in a module for
  11. * display suite
  12. */
  13. function tripal_ds_ds_layout_info() {
  14. $path = drupal_get_path('module', 'tripal_ds');
  15. $layouts = array(
  16. 'tripal_ds_feature' => array(
  17. 'label' => t('Tripal Feature Layout'),
  18. 'path' => $path . '/theme/templates',
  19. 'regions' => array(
  20. 'top' => t('Top'),
  21. 'left' => t('Left'),
  22. 'right' => t('Right'),
  23. 'bottom' => t('Bottom'),
  24. ),
  25. 'css' => TRUE,
  26. ),
  27. );
  28. return $layouts;
  29. }
  30. /*
  31. * General preprocess function to determine the HOOK for the subsequent preprocess functions
  32. * to target fields
  33. function tripal_ds_preprocess(&$vars, $hook) {
  34. if (isset($vars['elements']['#entity_type'])) {
  35. $function = __FUNCTION__ . '_' . $vars['elements']['#entity_type'];
  36. if (function_exists($function)) {
  37. $function($vars, $hook);
  38. }
  39. }
  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. }