-
Notifications
You must be signed in to change notification settings - Fork 3
/
taxonomy_menu.api.inc
95 lines (90 loc) · 2.9 KB
/
taxonomy_menu.api.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/**
* @file
* API functions.
*/
/**
* Add additional configuration options for taxonomy menu.
*
* Settings will be saved in the config file with the key of the form element,
* so don't include the module's name.
*
* @return array
* Form element definitions for the vocab settings form. If form element type
* is not provided, it is assumed to be a checkbox.
*/
function hook_taxonomy_menu_options() {
$options['expanded'] = array(
'#type' => 'checkbox', // This will be assumed if omitted.
'#title' => t('Automatically show all menu items as expanded.'),
'#default_value' => TRUE,
);
$options['max_depth'] = array(
'#type' => 'select',
'#title' => t('Max depth'),
'#description' => t('Limit how many levels of the taxonomy tree to process. Useful if you have a very large tree of taxonomy terms, and only want to provide a menu for the first several levels.'),
'#options' => array(0 => t('All'), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9),
'#default_value' => 0,
);
return $options
}
/**
* Update the taxonomy menu entry when being inserted.
*
* @param array $item
* A taxonomy menu item array with the following key/value pairs:
* 'tid': The term id.
* 'name': New menu name.
* 'description': New menu description, used for the title attribute.
* 'weight': New menu weight.
* 'vocabulary': Vocabulary machine name.
* 'ptid': The new parent tid.
* 'remove': If this is set to TRUE then the $item is not added as a menu.
*
* @return array $item
* The modified taxonomy menu item.
*/
function hook_taxonomy_menu_insert($item) {
// Modify $item here.
return $item;
}
/**
* Update the taxonomy menu entry when being updated.
*
* @param array $item
* A taxonomy menu item array with the following key/value pairs:
* 'tid': The term id.
* 'name': New menu name.
* 'description': New menu description, used for the title attribute.
* 'weight': New menu weight.
* 'vocabulary': Vocabulary machine name.
* 'ptid': The new parent tid.
* 'remove': If this is set to TRUE then the $item is not added as a menu.
*
* @return array $item
* The modified taxonomy menu item.
*/
function hook_taxonomy_menu_update($item) {
// Modify $item here.
return $item;
}
/**
* Update the taxonomy menu entry when being deleted.
*
* @param array $item
* A taxonomy menu item array with the following key/value pairs:
* 'tid': The term id.
* 'name': New menu name.
* 'description': New menu description, used for the title attribute.
* 'weight': New menu weight.
* 'vocabulary': Vocabulary machine name.
* 'ptid': The new parent tid.
* 'remove': If this is set to TRUE then the $item is not added as a menu.
*
* @return array $item
* The modified taxonomy menu item.
*/
function hook_taxonomy_menu_delete($item) {
// Modify $item here.
return $item;
}