taxonomy.variable.inc 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * @file
  4. * Variable API module. Definition for Drupal core variables
  5. */
  6. /**
  7. * Implements hook_variable_type_info()
  8. */
  9. function taxonomy_variable_type_info() {
  10. $type['vocabulary_vid'] = array(
  11. 'title' => t('Vocabulary'),
  12. 'options callback' => 'taxonomy_variable_vocabulary_vid_list',
  13. );
  14. $type['vocabulary_name'] = array(
  15. 'title' => t('Vocabulary'),
  16. 'options callback' => 'taxonomy_variable_vocabulary_name_list',
  17. );
  18. return $type;
  19. }
  20. /**
  21. * Options callback for vocabulary
  22. */
  23. function taxonomy_variable_vocabulary_vid_list($variable, $options) {
  24. static $list;
  25. if (!isset($list)) {
  26. foreach (taxonomy_get_vocabularies() as $vocab) {
  27. $list[$vocab->vid] = $vocab->name;
  28. };
  29. }
  30. return $list;
  31. }
  32. /**
  33. * Options callback for vocabulary
  34. */
  35. function taxonomy_variable_vocabulary_name_list($variable, $options) {
  36. static $list;
  37. if (!isset($list)) {
  38. foreach (taxonomy_get_vocabularies() as $vocab) {
  39. $list[$vocab->machine_name] = $vocab->name;
  40. };
  41. }
  42. return $list;
  43. }