forked from drupal-bootstrap/drupal-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.api.php
187 lines (172 loc) · 6.09 KB
/
bootstrap.api.php
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?php
/**
* @file
* Hooks provided by the Bootstrap base-theme.
*/
/**
* @addtogroup hooks
* @{
*/
/**
* Allows sub-themes to alter the array used for colorizing text.
*
* @param array $texts
* An associative array containing the text and classes to be matched, passed
* by reference.
*
* @see _bootstrap_colorize_text()
*/
function hook_bootstrap_colorize_text_alter(&$texts) {
// This matches the exact string: "My Unique Button Text".
$texts['matches'][t('My Unique Button Text')] = 'primary';
// This would also match the string above, however the class returned would
// also be the one above; "matches" takes precedence over "contains".
$texts['contains'][t('Unique')] = 'notice';
// Remove matching for strings that contain "apply":
unset($texts['contains'][t('Apply')]);
// Change the class that matches "Rebuild" (originally "warning"):
$texts['contains'][t('Rebuild')] = 'success';
}
/**
* Allows sub-themes to alter the array used for associating an icon with text.
*
* @param array $texts
* An associative array containing the text and icons to be matched, passed
* by reference.
*
* @see _bootstrap_iconize_text()
*/
function hook_bootstrap_iconize_text_alter(&$texts) {
// This matches the exact string: "My Unique Button Text".
$texts['matches'][t('My Unique Button Text')] = 'heart';
// This would also match the string above, however the class returned would
// also be the one above; "matches" takes precedence over "contains".
$texts['contains'][t('Unique')] = 'bullhorn';
// Remove matching for strings that contain "filter":
unset($texts['contains'][t('Filter')]);
// Change the icon that matches "Upload" (originally "upload"):
$texts['contains'][t('Upload')] = 'ok';
}
/**
* This hook allows sub-themes to process all form elements.
*
* For this hook to be recognized, it must reside directly inside the
* template.php file or via a file that is directly included into template.php.
*
* Any time a hook is added or removed, the Drupal cache must be completely
* cleared and rebuilt for the changes to take effect.
*
* Implementations of this hook should check to see if the element has a
* property named #bootstrap_ignore_process and check if it is set to TRUE.
* If it is, the hook should immediately return with the unaltered element.
*
* @param array $element
* The element array, this is NOT passed by reference and must return the
* altered element instead.
* @param array $form_state
* The form state array, passed by reference.
* @param array $form
* The complete form array, passed by reference.
*
* @return array
* The altered element array.
*
* @see bootstrap_element_info_alter()
* @see form_builder()
* @see drupal_process_form()
*/
function hook_form_process($element, &$form_state, &$form) {
return $element;
}
/**
* This hook allows sub-themes to process a specific form element type.
*
* For this hook to be recognized, it must reside directly inside the
* template.php file or via a file that is directly included into template.php.
*
* Any time a hook is added or removed, the Drupal cache must be completely
* cleared and rebuilt for the changes to take effect.
*
* If there is a matching "form_process_HOOK" function already defined
* (provided by core), it will be replaced. The theme replacing it will be
* responsible for fully processing the element as it was prior.
*
* Implementations of this hook should check to see if the element has a
* property named #bootstrap_ignore_process and check if it is set to TRUE.
* If it is, the hook should immediately return with the unaltered element.
*
* @param array $element
* The element array, this is NOT passed by reference and must return the
* altered element instead.
* @param array $form_state
* The form state array, passed by reference.
* @param array $form
* The complete form array, passed by reference.
*
* @return array
* The altered element array.
*
* @see bootstrap_element_info_alter()
* @see form_builder()
* @see drupal_process_form()
*/
function hook_form_process_HOOK($element, &$form_state, &$form) {
return $element;
}
/**
* This hook allows sub-themes to alter all elements before it's rendered.
*
* For this hook to be recognized, it must reside directly inside the
* template.php file or via a file that is directly included into template.php.
*
* Any time a hook is added or removed, the Drupal cache must be completely
* cleared and rebuilt for the changes to take effect.
*
* Implementations of this hook should check to see if the element has a
* property named #bootstrap_ignore_pre_render and check if it is set to TRUE.
* If it is, the hook should immediately return with the unaltered element.
*
* @param array $element
* The element array, this is NOT passed by reference and must return the
* altered element instead.
*
* @return array
* The altered element array.
*
* @see bootstrap_element_info_alter()
*/
function hook_pre_render($element) {
return $element;
}
/**
* This hook allows sub-themes to alter a specific element before it's rendered.
*
* For this hook to be recognized, it must reside directly inside the
* template.php file or via a file that is directly included into template.php.
*
* Any time a hook is added or removed, the Drupal cache must be completely
* cleared and rebuilt for the changes to take effect.
*
* If there is a matching "form_pre_render_HOOK" function already defined
* (provided by core), it will be replaced. The theme replacing it will be
* responsible for fully processing the element as it was prior.
*
* Implementations of this hook should check to see if the element has a
* property named #bootstrap_ignore_pre_render and check if it is set to TRUE.
* If it is, the hook should immediately return with the unaltered element.
*
* @param array $element
* The element array, this is NOT passed by reference and must return the
* altered element instead.
*
* @return array
* The altered element array.
*
* @see bootstrap_element_info_alter()
*/
function hook_pre_render_HOOK($element) {
return $element;
}
/**
* @} End of "addtogroup hooks".
*/