function tk_form_textfield($name, $args = array(), $return_object = FALSE) { $textfield = new TK_WP_Form_Textfield($name, $args); if (TRUE == $return_object) { return $textfield; } else { return $textfield->get_html(); } }
function get_html() { $this->merge_autocomplete_elements(); $html = parent::get_html(); $autocomplete_values = array(); foreach ($this->autocomplete_values as $key => $value) { array_push($autocomplete_values, '"' . $value . '"'); } $values = implode(',', $autocomplete_values); $html .= ' <script type="text/javascript"> jQuery(document).ready(function($){ $("#' . $this->id . '").autocomplete({ source: [' . $values . '] }); }); </script> '; return $html; }