name.api.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * @file
  4. * API documentation for the Name field module.
  5. */
  6. /**
  7. * Defines available name field autocomplete sources.
  8. *
  9. * @return array
  10. * An array of autocomplete sources. Each source is an associative array
  11. * that may contain the following key-value pairs:
  12. * - "name": Required. The label for the autocomplete source.
  13. * - "autocomplete callback": Optional. The function that does the query.
  14. * - "autocomplete arguments": Optional. Additional arguments to pass to
  15. * the callback function.
  16. * - "list callback": Optional. Returns a full data listing.
  17. * - "list arguments": Optional. Additional arguments to pass to
  18. * the callback function.
  19. * - "components": Optional. Limit the components are allowed this source.
  20. * - "autonomous": Optional. Determines if this can be run outside of the
  21. * field API. Defaults to FALSE.
  22. *
  23. * @see name_field_autocomplete_query()
  24. */
  25. function hook_name_data_sources() {
  26. return array(
  27. 'title' => array(
  28. 'name' => t('Title options'),
  29. 'components' => array('title'),
  30. 'autocomplete callback' => 'name_field_autocomplete_query',
  31. 'autocomplete arguments' => array('title'),
  32. 'list callback' => 'name_field_get_options',
  33. 'list arguments' => array(),
  34. ),
  35. 'data' => array(
  36. 'name' => t('Existing content'),
  37. 'autonomous' => TRUE,
  38. 'autocomplete callback' => 'name_field_data_query',
  39. ),
  40. );
  41. }
  42. /**
  43. * Allows other modules to react to hook_field_insert().
  44. *
  45. * Triggers a custom hook for name field inserts. Field API only calls the
  46. * module that defines the field.
  47. *
  48. * @see hook_field_insert()
  49. */
  50. function hook_name_field_insert_notification($entity_type, $entity, $field, $instance, $langcode, &$items) {
  51. }
  52. /**
  53. * Allows other modules to react to hook_field_update().
  54. *
  55. * Triggers a custom hook for name field updates. Field API only calls the
  56. * module that defines the field.
  57. *
  58. * @see hook_field_update()
  59. */
  60. function hook_name_field_update_notification($entity_type, $entity, $field, $instance, $langcode, &$items) {
  61. }