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