tripal_ds.module 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. require_once "includes/tripal_ds.inc";
  3. require_once "includes/tripal_ds.ds.inc";
  4. function tripal_ds_init() {
  5. drupal_add_css(drupal_get_path('module', 'tripal_ds') . '/theme/css/tripaldsfeature.css');
  6. }
  7. /**
  8. * Implements hook_ds_layout_info() to define layouts from code in a module for
  9. * display suite
  10. */
  11. function tripal_ds_ds_layout_info() {
  12. $path = drupal_get_path('module', 'tripal_ds');
  13. $layouts = array(
  14. 'tripal_ds_feature' => array(
  15. 'label' => t('Tripal Feature Layout'),
  16. 'path' => $path . '/theme/templates',
  17. 'regions' => array(
  18. 'top' => t('Top'),
  19. 'left' => t('Left'),
  20. 'right' => t('Right'),
  21. 'bottom' => t('Bottom'),
  22. ),
  23. 'css' => TRUE,
  24. ),
  25. );
  26. return $layouts;
  27. }
  28. /*
  29. * General preprocess function to determine the HOOK for the subsequent preprocess functions
  30. * to target fields
  31. function tripal_ds_preprocess(&$vars, $hook) {
  32. if (isset($vars['elements']['#entity_type'])) {
  33. $function = __FUNCTION__ . '_' . $vars['elements']['#entity_type'];
  34. if (function_exists($function)) {
  35. $function($vars, $hook);
  36. }
  37. }
  38. }
  39. */
  40. /**
  41. * Implements hook_bundle_postcreate().
  42. *
  43. * This is a Triapl defined hook and is called in the TripalBundle::create()
  44. * function to allow modules to perform tasks when a bundle is created.
  45. */
  46. function tripal_ds_bundle_postcreate($bundle) {
  47. $bundle_name = $bundle->name;
  48. $instances = field_info_instances('TripalEntity', $bundle_name);
  49. _ds_layout_settings_info($bundle_name, $instances);
  50. }