function theme_rules_autocomplete in Rules 7.2
Themes rules autocomplete forms.
1 theme call to theme_rules_autocomplete()
- rules_element_info in ./
rules.module - Implements hook_element_info().
File
- ui/
ui.theme.inc, line 271 - Rules theme functions.
Code
function theme_rules_autocomplete($variables) {
$element = $variables['element'];
drupal_add_js(drupal_get_path('module', 'rules') . '/ui/rules.autocomplete.js');
drupal_add_library('system', 'ui.autocomplete');
drupal_add_library('system', 'ui.button');
$element['#attributes']['type'] = 'text';
element_set_attributes($element, array(
'id',
'name',
'value',
'size',
'maxlength',
));
_form_set_class($element, array(
'form-text',
'rules-autocomplete',
));
$id = $element['#attributes']['id'];
$id_button = drupal_html_id($id . '-button');
$js_vars['rules_autocomplete'][$id] = array(
'inputId' => $id,
'source' => url($element['#autocomplete_path'], array(
'absolute' => TRUE,
)),
);
drupal_add_js($js_vars, 'setting');
$output = '<div class="rules-autocomplete">';
$output .= '<input' . drupal_attributes($element['#attributes']) . ' />';
$output .= '</div>';
return $output;
}