content_taxonomy.api.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * @file
  4. * This file contains no working PHP code; it exists to provide additional
  5. * documentation for doxygen as well as to document hooks in the standard
  6. * Drupal manner.
  7. */
  8. /**
  9. * @addtogroup hooks
  10. * @{
  11. */
  12. /**
  13. * Alter the term tree callback that is used for content taxonomy options lists.
  14. *
  15. * By default taxonomy_get_tree is used to retrieve the list of terms. It is
  16. * important that any provided tree callback must have the same function
  17. * signature as hook_content_taxonomy_tree_callback_alter().
  18. * For example this hook can be used to exchange the callback with a language
  19. * specific tree function.
  20. *
  21. * @param $tree_callback
  22. * The current callback that can be overridden.
  23. * @param $field
  24. * The term reference field info array.
  25. * @param $vocabulary
  26. * The vocabulary object for which the term list should be retrieved. One
  27. * field can have multiple vocabularies attached, which leads to multiple
  28. * invocations of this function.
  29. */
  30. function hook_content_taxonomy_tree_callback_alter(&$tree_callback, $field, $vocabulary) {
  31. if ($vocabulary->machine_name == 'my_voc') {
  32. $tree_callback = 'my_tree_callback';
  33. }
  34. }
  35. /**
  36. * @} End of "addtogroup hooks".
  37. */