Révision 388c412d
Ajouté par Assos Assos il y a environ 7 ans
drupal7/sites/all/themes/bootstrap/templates/system/textfield.func.php | ||
---|---|---|
34 | 34 |
|
35 | 35 |
$output = '<input' . drupal_attributes($element['#attributes']) . ' />'; |
36 | 36 |
|
37 |
$extra = ''; |
|
38 | 37 |
if ($element['#autocomplete_path'] && !empty($element['#autocomplete_input'])) { |
39 | 38 |
drupal_add_library('system', 'drupal.autocomplete'); |
40 | 39 |
$element['#attributes']['class'][] = 'form-autocomplete'; |
41 | 40 |
|
42 |
$attributes = array(); |
|
43 |
$attributes['type'] = 'hidden'; |
|
44 |
$attributes['id'] = $element['#autocomplete_input']['#id']; |
|
45 |
$attributes['value'] = $element['#autocomplete_input']['#url_value']; |
|
46 |
$attributes['disabled'] = 'disabled'; |
|
47 |
$attributes['class'][] = 'autocomplete'; |
|
48 |
// Uses icon for autocomplete "throbber". |
|
49 |
if ($icon = _bootstrap_icon('refresh')) { |
|
50 |
$output = '<div class="input-group">' . $output . '<span class="input-group-addon">' . $icon . '</span></div>'; |
|
41 |
// Append a hidden autocomplete element. |
|
42 |
$autocomplete = array( |
|
43 |
'#type' => 'hidden', |
|
44 |
'#value' => $element['#autocomplete_input']['#url_value'], |
|
45 |
'#attributes' => array( |
|
46 |
'class' => array('autocomplete'), |
|
47 |
'disabled' => 'disabled', |
|
48 |
'id' => $element['#autocomplete_input']['#id'], |
|
49 |
), |
|
50 |
); |
|
51 |
$output .= drupal_render($autocomplete); |
|
52 |
|
|
53 |
// Append icon for autocomplete "throbber" or use core's default throbber |
|
54 |
// whose background image must be set here because sites may not be |
|
55 |
// at the root of the domain (ie: /) and this value cannot be set via CSS. |
|
56 |
if (!isset($element['#autocomplete_icon'])) { |
|
57 |
$element['#autocomplete_icon'] = _bootstrap_icon('refresh', '<span class="autocomplete-throbber" style="background-image:url(' . file_create_url('misc/throbber.gif') . ')"></span>'); |
|
51 | 58 |
} |
52 |
// Fallback to using core's throbber. |
|
53 |
else { |
|
54 |
$output = '<div class="input-group">' . $output . '<span class="input-group-addon">'; |
|
55 |
// The throbber's background image must be set here because sites may not |
|
56 |
// be at the root of the domain (ie: /) and this value cannot be set via |
|
57 |
// CSS. |
|
58 |
$output .= '<span class="autocomplete-throbber" style="background-image:url(' . file_create_url('misc/throbber.gif') . ')"></span>'; |
|
59 |
$output .= '</span></div>'; |
|
59 |
|
|
60 |
// Only add an icon if there is one. |
|
61 |
if ($element['#autocomplete_icon']) { |
|
62 |
$output .= '<span class="input-group-addon">' . $element['#autocomplete_icon'] . '</span>'; |
|
63 |
|
|
64 |
// Wrap entire element in a input group if not already in one. |
|
65 |
if (!isset($element['#input_group']) && !isset($element['#input_group_button'])) { |
|
66 |
$input_group_attributes = isset($element['#input_group_attributes']) ? $element['#input_group_attributes'] : array(); |
|
67 |
if (!isset($input_group_attributes['class'])) { |
|
68 |
$input_group_attributes['class'] = array(); |
|
69 |
} |
|
70 |
if (!in_array('input-group', $input_group_attributes['class'])) { |
|
71 |
$input_group_attributes['class'][] = 'input-group'; |
|
72 |
} |
|
73 |
$output = '<div' . drupal_attributes($input_group_attributes) . '>' . $output . '</div>'; |
|
74 |
} |
|
60 | 75 |
} |
61 |
$extra = '<input' . drupal_attributes($attributes) . ' />'; |
|
62 | 76 |
} |
63 | 77 |
|
64 |
return $output . $extra;
|
|
78 |
return $output; |
|
65 | 79 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules