root / drupal7 / sites / all / themes / bootstrap / templates / webform / webform-element.vars.php @ caf16a48
1 | caf16a48 | Assos Assos | <?php
|
---|---|---|---|
2 | /**
|
||
3 | * @file
|
||
4 | * Stub file for "webform_element" theme hook [pre]process functions.
|
||
5 | */
|
||
6 | |||
7 | /**
|
||
8 | * Pre-processes variables for the "webform_element" theme hook.
|
||
9 | *
|
||
10 | * See theme function for list of available variables.
|
||
11 | *
|
||
12 | * @see theme_webform_element()
|
||
13 | *
|
||
14 | * @ingroup theme_preprocess
|
||
15 | */
|
||
16 | function bootstrap_preprocess_webform_element(&$variables) { |
||
17 | $element = $variables['element']; |
||
18 | $wrapper_attributes = array(); |
||
19 | if (isset($element['#wrapper_attributes'])) { |
||
20 | $wrapper_attributes = $element['#wrapper_attributes']; |
||
21 | } |
||
22 | |||
23 | // See http://getbootstrap.com/css/#forms-controls.
|
||
24 | if (isset($element['#type'])) { |
||
25 | if ($element['#type'] === 'radio') { |
||
26 | $wrapper_attributes['class'][] = 'radio'; |
||
27 | } |
||
28 | elseif ($element['#type'] === 'checkbox') { |
||
29 | $wrapper_attributes['class'][] = 'checkbox'; |
||
30 | } |
||
31 | elseif ($element['#type'] !== 'hidden') { |
||
32 | $wrapper_attributes['class'][] = 'form-group'; |
||
33 | } |
||
34 | } |
||
35 | |||
36 | $variables['element']['#wrapper_attributes'] = $wrapper_attributes; |
||
37 | } |