TripalStorage.inc 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. class TripalStorage {
  3. // An associative array containing information about this storage backend.
  4. // The valid keys are those specified in the hook_field_storage_info().
  5. static $information = array(
  6. 'label' => '',
  7. 'description' => '',
  8. 'settings' => array(),
  9. );
  10. /**
  11. * Provides default information about this storage type.
  12. *
  13. * This function corresponds to the hook_field_storage_info() function of
  14. * the Drupal Storage API.
  15. *
  16. * @return
  17. * An array whose keys the same as for the
  18. * hook_field_storage_info() function.
  19. */
  20. public function info() {
  21. $class = get_called_class();
  22. return array(
  23. $class => $class::$information,
  24. );
  25. }
  26. /**
  27. * Loads the fields that are supported by the storage backend.
  28. *
  29. * This function should behave just as the hook_field_storage_load() function.
  30. * See the documentation for that hook for example implementation.
  31. *
  32. * @param $entity_type
  33. * The type of entity (typically a bundle of TripalEntity).
  34. * @param unknown $entities
  35. * The array of entity objects to add fields to, keyed by entity ID.
  36. * @param unknown $age
  37. * FIELD_LOAD_CURRENT to load the most recent revision for all fields, or
  38. * FIELD_LOAD_REVISION to load the version indicated by each entity.
  39. * @param unknown $fields
  40. * An array listing the fields to be loaded. The keys of the array are field
  41. * IDs, and the values of the array are the entity IDs (or revision IDs,
  42. * depending on the $age parameter) to add each field to.
  43. * @param unknown $options
  44. * An associative array of additional options, with the following keys:
  45. * - deleted: If TRUE, deleted fields should be loaded as well as
  46. * non-deleted fields. If unset or FALSE, only non-deleted fields
  47. * should be loaded.
  48. */
  49. public function load($entity_type, $entities, $age,
  50. $fields, $options) {
  51. }
  52. /**
  53. * Searches for entities that match field conditions.
  54. *
  55. * This function is similar to the hook_field_storage_query(). Each
  56. * TripalStorage class is responsible for querying it's own storage
  57. * system using the conditions provided in the $query argument.
  58. *
  59. * @param $query
  60. * A TripalFieldQuery object.
  61. *
  62. * @return
  63. * See EntityFieldQuery::execute() for the return values.
  64. */
  65. public function query($query) {
  66. }
  67. }