123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <?php
- function bootstrap_form_process($element, &$form_state, &$form) {
- if (!empty($element['#bootstrap_ignore_process'])) {
- return $element;
- }
- if (!empty($element['#attributes']['class']) && is_array($element['#attributes']['class'])) {
- $key = array_search('container-inline', $element['#attributes']['class']);
- if ($key !== FALSE) {
- $element['#attributes']['class'][$key] = 'form-inline';
- }
- if (in_array('form-wrapper', $element['#attributes']['class'])) {
- $element['#attributes']['class'][] = 'form-group';
- }
- }
-
-
- if (!empty($element['#input_group_button'])) {
-
- $array_parents = array();
- if (!empty($element['#array_parents'])) {
- $array_parents += $element['#array_parents'];
-
- array_pop($array_parents);
- }
-
- if (!empty($array_parents)) {
- $parent = &drupal_array_get_nested_value($form, $array_parents);
- }
-
- else {
- $parent = &$form;
- }
-
- $found_current_element = FALSE;
- foreach (element_children($parent, TRUE) as $child) {
- if ($parent[$child] === $element) {
- $found_current_element = TRUE;
- continue;
- }
- if ($found_current_element && _bootstrap_is_button($parent[$child]) && (!isset($parent[$child]['#access']) || !!$parent[$child]['#access'])) {
- $element['#field_suffix'] = drupal_render($parent[$child]);
- break;
- }
- }
- }
- return $element;
- }
- function bootstrap_form_process_actions($element, &$form_state, &$form) {
- $element['#attributes']['class'][] = 'form-actions';
- if (!empty($element['#bootstrap_ignore_process'])) {
- return $element;
- }
- foreach (element_children($element) as $child) {
- _bootstrap_iconize_button($element[$child]);
- }
- return $element;
- }
- function bootstrap_form_process_text_format($element, &$form_state, &$form) {
- if (!empty($element['#bootstrap_ignore_process'])) {
- return $element;
- }
-
- bootstrap_element_smart_description($element, $element['value']);
-
- $element['format']['#attributes']['class'][] = 'form-inline';
-
- $element['format']['guidelines']['#access'] = FALSE;
-
- $element['format']['format']['#title_display'] = 'none';
-
- $element['format']['format']['#attributes']['class'][] = 'input-sm';
-
- $element['format']['format']['#attributes']['data-style'] = 'btn-sm btn-default';
- return $element;
- }
|