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
96
97
98
99
100
101 | <?php
function vertical_tabs_example_menu() {
$items['examples/vertical_tabs'] = array(
'title' => 'Vertical tabs example',
'description' => 'Shows how vertical tabs can best be supported by a custom module',
'page callback' => '_vertical_tabs_example_explanation',
'access callback' => TRUE,
);
return $items;
}
function vertical_tabs_example_form_alter(&$form, $form_state, $form_id) {
if (!empty($form['#node_edit_form'])) {
$form['vertical_tabs_example'] = array(
'#type' => 'fieldset',
'#title' => t('Example vertical tab'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#group' => 'additional_settings',
'#attached' => array(
'js' => array(
'vertical-tabs' => drupal_get_path('module', 'vertical_tabs_example') . '/vertical_tabs_example.js',
),
),
'#tree' => TRUE,
'#weight' => -2,
);
$form['vertical_tabs_example']['enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Use custom configuration'),
'#default_value' => FALSE,
);
$form['vertical_tabs_example']['vertical_tabs_examplecontainer'] = array(
'#type' => 'container',
'#parents' => array('vertical_tabs_example'),
'#states' => array(
'invisible' => array(
'input[name="vertical_tabs_example[enabled]"]' => array('checked' => FALSE),
),
),
);
$form['vertical_tabs_example']['vertical_tabs_examplecontainer']['custom_setting'] = array(
'#type' => 'textfield',
'#title' => t('Use this custom setting'),
'#default_value' => '',
);
}
}
function _vertical_tabs_example_explanation() {
return t("The Vertical Tabs Example shows how a custom module can best support vertical tabs. To see the effects of this module, look at the <a href='!node_add'>node/add</a> form", array('!node_add' => url('node/add')));
}
|