tripal_chado_field.inc 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. /* TODO: it may be eaiser to help train developers at creating new
  3. * fields if it was a class rather than a bunch of hooks. Below is
  4. * the starting point.
  5. */
  6. /**
  7. * A base class for all Fields supported by the Tripal Chado module.
  8. *
  9. */
  10. class TripalChadoField {
  11. /**
  12. * Implements hook_info() for fields.
  13. *
  14. * This is a hook provided by the tripal_chado module for offloading the
  15. * hook_field_info() hook for each field to specify.
  16. */
  17. public function info() {
  18. return array(
  19. );
  20. }
  21. /**
  22. * Implements hook_widget_info.
  23. *
  24. * This is a hook provided by the tripal_chado module for offloading
  25. * the hook_field_widget_info() hook for each field to specify.
  26. */
  27. public function widget_info() {
  28. return array(
  29. );
  30. }
  31. /**
  32. * Implements hook_formatter_info.
  33. *
  34. * This is a hook provided by the tripal_chado module for
  35. * offloading the hook_field_formatter_info() for each field
  36. * to specify.
  37. *
  38. */
  39. public function formatter_info() {
  40. return array(
  41. );
  42. }
  43. /**
  44. * Implements hook_formatter_settings_summary.
  45. *
  46. * This is a hook provided by the tripal_chado module for
  47. * offloading the hook_field_formatter_settings_summary() for each field
  48. * to specify.
  49. *
  50. */
  51. public function formatter_settings_summary($field, $instance, $view_mode) {
  52. }
  53. /**
  54. * Provides a settings form for the formatter.
  55. *
  56. * This is a hook provided by the tripal_chado module for
  57. * offloading the hook_field_formatter_settings_form() for each field
  58. * to specify.
  59. */
  60. public function formatter_settings_form($field, $instance,
  61. $view_mode, $form, &$form_state) {
  62. }
  63. /**
  64. *
  65. */
  66. public function formatter(&$element, $entity_type, $entity,
  67. $field, $instance, $langcode, $items, $display) {
  68. }
  69. /**
  70. * Loads the field values with appropriate data.
  71. *
  72. * This function is called by the tripal_chado_field_storage_load() for
  73. * each property managed by the field_chado_storage storage type. This is
  74. * an optional hook function that is only needed if the field has
  75. * multiple form elements.
  76. *
  77. * @param $field
  78. * @param $entity
  79. * @param $base_table
  80. * @param $record
  81. */
  82. public function load($field, $entity, $base_table, $record) {
  83. }
  84. /**
  85. * Implements hook_ws_formatter().
  86. */
  87. public function ws_formatter(&$element, $entity_type, $entity,
  88. $field, $instance, $items) {
  89. }
  90. /**
  91. * Implements hook_widget().
  92. */
  93. public function widget(&$widget, $form, $form_state, $field, $instance,
  94. $langcode, $items, $delta, $element) {
  95. }
  96. /**
  97. * Callback function for validating the widget_.
  98. */
  99. static function widget_validate($element, &$form_state) {
  100. }
  101. /**
  102. *
  103. */
  104. public function attach_info($entity_type, $bundle) {
  105. }
  106. }