1 |
87dbc3bf
|
Benjamin Luce
|
<?php
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
function bootstrap_textfield($variables) {
|
11 |
|
|
$element = $variables['element'];
|
12 |
|
|
$element['#attributes']['type'] = 'text';
|
13 |
|
|
element_set_attributes($element, array(
|
14 |
|
|
'id',
|
15 |
|
|
'name',
|
16 |
|
|
'value',
|
17 |
|
|
'size',
|
18 |
|
|
'maxlength',
|
19 |
|
|
));
|
20 |
|
|
_form_set_class($element, array('form-text'));
|
21 |
|
|
|
22 |
|
|
$output = '<input' . drupal_attributes($element['#attributes']) . ' />';
|
23 |
|
|
|
24 |
|
|
$extra = '';
|
25 |
|
|
if ($element['#autocomplete_path'] && drupal_valid_path($element['#autocomplete_path'])) {
|
26 |
|
|
drupal_add_library('system', 'drupal.autocomplete');
|
27 |
|
|
$element['#attributes']['class'][] = 'form-autocomplete';
|
28 |
|
|
|
29 |
|
|
$attributes = array();
|
30 |
|
|
$attributes['type'] = 'hidden';
|
31 |
|
|
$attributes['id'] = $element['#attributes']['id'] . '-autocomplete';
|
32 |
|
|
$attributes['value'] = url($element['#autocomplete_path'], array('absolute' => TRUE));
|
33 |
|
|
$attributes['disabled'] = 'disabled';
|
34 |
|
|
$attributes['class'][] = 'autocomplete';
|
35 |
|
|
$output = '<div class="input-group">' . $output . '<span class="input-group-addon">' . _bootstrap_icon('refresh') . '</span></div>';
|
36 |
|
|
$extra = '<input' . drupal_attributes($attributes) . ' />';
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
return $output . $extra;
|
40 |
|
|
} |