WebServicesFieldFormatter.inc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. /**
  3. * @class
  4. * Purpose:
  5. *
  6. * Display:
  7. * Configuration:
  8. */
  9. class WebServicesFieldFormatter extends TripalFieldFormatter {
  10. /*
  11. // The default label for this field.
  12. public static $default_label = '';
  13. // The list of field types for which this formatter is appropriate.
  14. public static $field_types = array();
  15. // The list of default settings for this formatter.
  16. public static $default_settings = array(
  17. 'key' => 'default_value',
  18. );
  19. /**
  20. * Provides the field's setting form.
  21. *
  22. * This function corresponds to the hook_field_formatter_settings_form()
  23. * function of the Drupal Field API.
  24. *
  25. * The settings form appears on the 'Manage Display' page of the content
  26. * type administration page. This function provides the form that will
  27. * appear on that page.
  28. *
  29. * To add a validate function, please create a static function in the
  30. * implementing class, and indicate that this function should be used
  31. * in the form array that is returned by this function.
  32. *
  33. * This form will not be displayed if the formatter_settings_summary()
  34. * function does not return anything.
  35. *
  36. * param $field
  37. * The field structure being configured.
  38. * param $instance
  39. * The instance structure being configured.
  40. * param $view_mode
  41. * The view mode being configured.
  42. * param $form
  43. * The (entire) configuration form array, which will usually have no use
  44. * here. Typically for reference only.
  45. * param $form_state
  46. * The form state of the (entire) configuration form.
  47. *
  48. * @return
  49. * A Drupal Form array containing the settings form for this field.
  50. public function settingsForm($view_mode, $form, &$form_state) {
  51. }
  52. /**
  53. * Provides the display for a field
  54. *
  55. * This function corresponds to the hook_field_formatter_view()
  56. * function of the Drupal Field API.
  57. *
  58. * This function provides the display for a field when it is viewed on
  59. * the web page. The content returned by the formatter should only include
  60. * what is present in the $items[$delta]['values] array. This way, the
  61. * contents that are displayed on the page, via webservices and downloaded
  62. * into a CSV file will always be identical. The view need not show all
  63. * of the data in the 'values' array.
  64. *
  65. * @param $element
  66. * @param $entity_type
  67. * @param $entity
  68. * @param $langcode
  69. * @param $items
  70. * @param $display
  71. *
  72. * @return
  73. * An element array compatible with that returned by the
  74. * hook_field_formatter_view() function.
  75. public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
  76. // Get the settings
  77. $settings = $display['settings'];
  78. }
  79. /**
  80. * Provides a summary of the formatter settings.
  81. *
  82. * This function corresponds to the hook_field_formatter_settings_summary()
  83. * function of the Drupal Field API.
  84. *
  85. * On the 'Manage Display' page of the content type administration page,
  86. * fields are allowed to provide a settings form. This settings form can
  87. * be used to allow the site admin to define how the field should be
  88. * formatted. The settings are then available for the formatter()
  89. * function of this class. This function provides a text-based description
  90. * of the settings for the site developer to see. It appears on the manage
  91. * display page inline with the field. A field must always return a
  92. * value in this function if the settings form gear button is to appear.
  93. *
  94. * See the hook_field_formatter_settings_summary() function for more
  95. * information.
  96. *
  97. * @param $field
  98. * @param $instance
  99. * @param $view_mode
  100. *
  101. * @return string
  102. * A string that provides a very brief summary of the field settings
  103. * to the user.
  104. *
  105. public function settingsSummary($view_mode) {
  106. }
  107. */
  108. }