tripal_ds.pane.api.inc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * @file
  4. * Tripal offers a display suite integration for additional fields.
  5. */
  6. /**
  7. * @defgroup tripal_ds_pane_api Tripal DS API
  8. * @ingroup tripal_ds_api
  9. * @{
  10. * Tripal DS allows for the extension of the display suite module interface used
  11. * to display the tripal entity fields. The API allows for other modules to
  12. * integrate Tripal Pane creation, placement, and formatting.
  13. * @}
  14. */
  15. /**
  16. * Adds a new Tripal Pane to a bundle.
  17. *
  18. * @param $field
  19. * The machine name for the field.
  20. * @param $bundle_name
  21. * The name of the bundle the pane is being added to.
  22. * @param $field_label
  23. * The human readable name for the field.
  24. *
  25. * Example usage:
  26. *
  27. * @code
  28. * field_create_field($field);
  29. * field_create_instance($instance);
  30. * tripal_ds_field_create_field($field_label, $field, $bundle);
  31. *
  32. * @ingroup tripal_ds_pane_api
  33. *
  34. */
  35. function tripal_ds_create_field($field_label, $field_name, $bundle_name) {
  36. $field_name = str_replace(' ', '_', strtolower($field_name));
  37. //Build the rest of the passes parameters.
  38. $group_field_name = 'gp_' . $field_name;
  39. //Create the field groups.
  40. tripal_ds_add_generic_field_group($bundle_name, $field_label, $group_field_name, $field_name);
  41. //Place the field groups in the layout.
  42. tripal_ds_update_ds_layout($bundle_name, $field_name, $group_field_name);
  43. }