Projet

Général

Profil

Paste
Télécharger (6,25 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / bootstrap / bootstrap.api.php @ 01f36513

1 caf16a48 Assos Assos
<?php
2 eefc2ac0 Assos Assos
3 caf16a48 Assos Assos
/**
4
 * @file
5
 * List of available hook and alter APIs for use in your sub-theme.
6
 */
7
8
/**
9
 * @defgroup api APIs
10
 *
11
 * List of available hook and alter APIs for use in your sub-theme.
12
 *
13
 * @{
14
 */
15
16
/**
17
 * Allows sub-themes to alter the array used for colorizing text.
18
 *
19
 * @param array $texts
20
 *   An associative array containing the text and classes to be matched, passed
21
 *   by reference.
22
 *
23
 * @see _bootstrap_colorize_text()
24
 */
25 eefc2ac0 Assos Assos
function hook_bootstrap_colorize_text_alter(array &$texts) {
26 caf16a48 Assos Assos
  // This matches the exact string: "My Unique Button Text".
27
  $texts['matches'][t('My Unique Button Text')] = 'primary';
28
29
  // This would also match the string above, however the class returned would
30
  // also be the one above; "matches" takes precedence over "contains".
31
  $texts['contains'][t('Unique')] = 'notice';
32
33
  // Remove matching for strings that contain "apply":
34
  unset($texts['contains'][t('Apply')]);
35
36
  // Change the class that matches "Rebuild" (originally "warning"):
37
  $texts['contains'][t('Rebuild')] = 'success';
38
}
39
40
/**
41
 * Allows sub-themes to alter the array used for associating an icon with text.
42
 *
43
 * @param array $texts
44
 *   An associative array containing the text and icons to be matched, passed
45
 *   by reference.
46
 *
47
 * @see _bootstrap_iconize_text()
48
 */
49 eefc2ac0 Assos Assos
function hook_bootstrap_iconize_text_alter(array &$texts) {
50 caf16a48 Assos Assos
  // This matches the exact string: "My Unique Button Text".
51
  $texts['matches'][t('My Unique Button Text')] = 'heart';
52
53
  // This would also match the string above, however the class returned would
54
  // also be the one above; "matches" takes precedence over "contains".
55
  $texts['contains'][t('Unique')] = 'bullhorn';
56
57
  // Remove matching for strings that contain "filter":
58
  unset($texts['contains'][t('Filter')]);
59
60
  // Change the icon that matches "Upload" (originally "upload"):
61
  $texts['contains'][t('Upload')] = 'ok';
62
}
63
64
/**
65
 * This hook allows sub-themes to process all form elements.
66
 *
67
 * For this hook to be recognized, it must reside directly inside the
68
 * template.php file or via a file that is directly included into template.php.
69
 *
70
 * Any time a hook is added or removed, the Drupal cache must be completely
71
 * cleared and rebuilt for the changes to take effect.
72
 *
73
 * Implementations of this hook should check to see if the element has a
74
 * property named #bootstrap_ignore_process and check if it is set to TRUE.
75
 * If it is, the hook should immediately return with the unaltered element.
76
 *
77
 * @param array $element
78
 *   The element array, this is NOT passed by reference and must return the
79
 *   altered element instead.
80
 * @param array $form_state
81
 *   The form state array, passed by reference.
82
 * @param array $form
83
 *   The complete form array, passed by reference.
84
 *
85
 * @return array
86
 *   The altered element array.
87
 *
88
 * @see bootstrap_element_info_alter()
89
 * @see form_builder()
90
 * @see drupal_process_form()
91
 */
92 eefc2ac0 Assos Assos
function hook_form_process(array $element, array &$form_state, array &$form) {
93 caf16a48 Assos Assos
  return $element;
94
}
95
96
/**
97
 * This hook allows sub-themes to process a specific form element type.
98
 *
99
 * For this hook to be recognized, it must reside directly inside the
100
 * template.php file or via a file that is directly included into template.php.
101
 *
102
 * Any time a hook is added or removed, the Drupal cache must be completely
103
 * cleared and rebuilt for the changes to take effect.
104
 *
105
 * If there is a matching "form_process_HOOK" function already defined
106
 * (provided by core), it will be replaced. The theme replacing it will be
107
 * responsible for fully processing the element as it was prior.
108
 *
109
 * Implementations of this hook should check to see if the element has a
110
 * property named #bootstrap_ignore_process and check if it is set to TRUE.
111
 * If it is, the hook should immediately return with the unaltered element.
112
 *
113
 * @param array $element
114
 *   The element array, this is NOT passed by reference and must return the
115
 *   altered element instead.
116
 * @param array $form_state
117
 *   The form state array, passed by reference.
118
 * @param array $form
119
 *   The complete form array, passed by reference.
120
 *
121
 * @return array
122
 *   The altered element array.
123
 *
124
 * @see bootstrap_element_info_alter()
125
 * @see form_builder()
126
 * @see drupal_process_form()
127
 */
128 eefc2ac0 Assos Assos
function hook_form_process_HOOK(array $element, array &$form_state, array &$form) {
129 caf16a48 Assos Assos
  return $element;
130
}
131
132
/**
133
 * This hook allows sub-themes to alter all elements before it's rendered.
134
 *
135
 * For this hook to be recognized, it must reside directly inside the
136
 * template.php file or via a file that is directly included into template.php.
137
 *
138
 * Any time a hook is added or removed, the Drupal cache must be completely
139
 * cleared and rebuilt for the changes to take effect.
140
 *
141
 * Implementations of this hook should check to see if the element has a
142
 * property named #bootstrap_ignore_pre_render and check if it is set to TRUE.
143
 * If it is, the hook should immediately return with the unaltered element.
144
 *
145
 * @param array $element
146
 *   The element array, this is NOT passed by reference and must return the
147
 *   altered element instead.
148
 *
149
 * @return array
150
 *   The altered element array.
151
 *
152
 * @see bootstrap_element_info_alter()
153
 */
154 eefc2ac0 Assos Assos
function hook_pre_render(array $element) {
155 caf16a48 Assos Assos
  return $element;
156
}
157
158
/**
159
 * This hook allows sub-themes to alter a specific element before it's rendered.
160
 *
161
 * For this hook to be recognized, it must reside directly inside the
162
 * template.php file or via a file that is directly included into template.php.
163
 *
164
 * Any time a hook is added or removed, the Drupal cache must be completely
165
 * cleared and rebuilt for the changes to take effect.
166
 *
167
 * If there is a matching "form_pre_render_HOOK" function already defined
168
 * (provided by core), it will be replaced. The theme replacing it will be
169
 * responsible for fully processing the element as it was prior.
170
 *
171
 * Implementations of this hook should check to see if the element has a
172
 * property named #bootstrap_ignore_pre_render and check if it is set to TRUE.
173
 * If it is, the hook should immediately return with the unaltered element.
174
 *
175
 * @param array $element
176
 *   The element array, this is NOT passed by reference and must return the
177
 *   altered element instead.
178
 *
179
 * @return array
180
 *   The altered element array.
181
 *
182
 * @see bootstrap_element_info_alter()
183
 */
184 eefc2ac0 Assos Assos
function hook_pre_render_HOOK(array $element) {
185 caf16a48 Assos Assos
  return $element;
186
}
187
188
/**
189
 * @} End of "defgroup subtheme_api".
190
 */