@@ -56,6 +56,7 @@ function kalatheme_process_element(&$element, &$form_state) {
5656function kalatheme_process_input (&$ element , &$ form_state ) {
5757 $ types = array (
5858 'textfield ' ,
59+ 'textarea ' ,
5960 'password ' ,
6061 'password_confirm ' ,
6162 'select ' ,
@@ -71,9 +72,47 @@ function kalatheme_process_input(&$element, &$form_state) {
7172 if (!empty ($ element ['#type ' ]) && (in_array ($ element ['#type ' ], $ types ))) {
7273 $ element ['#attributes ' ]['class ' ][] = 'form-control ' ;
7374 }
75+
7476 return $ element ;
7577}
7678
79+ /**
80+ * Implements theme_textfield().
81+ */
82+ function kalatheme_textfield ($ variables ) {
83+ $ element = $ variables ['element ' ];
84+ $ element ['#attributes ' ]['type ' ] = 'text ' ;
85+ element_set_attributes ($ element , array (
86+ 'id ' ,
87+ 'name ' ,
88+ 'value ' ,
89+ 'size ' ,
90+ 'maxlength ' ,
91+ ));
92+ _form_set_class ($ element , array ('form-text ' ));
93+
94+ $ output = '<input ' . drupal_attributes ($ element ['#attributes ' ]) . ' /> ' ;
95+
96+ $ extra = '' ;
97+ if (isset ($ element ['#autocomplete_path ' ]) && drupal_valid_path ($ element ['#autocomplete_path ' ])) {
98+ drupal_add_library ('system ' , 'drupal.autocomplete ' );
99+ $ element ['#attributes ' ]['class ' ][] = 'form-autocomplete ' ;
100+
101+ $ attributes = array ();
102+ $ attributes ['type ' ] = 'hidden ' ;
103+ $ attributes ['id ' ] = $ element ['#attributes ' ]['id ' ] . '-autocomplete ' ;
104+ $ attributes ['value ' ] = url ($ element ['#autocomplete_path ' ], array ('absolute ' => TRUE ));
105+ $ attributes ['disabled ' ] = 'disabled ' ;
106+ $ attributes ['class ' ][] = 'autocomplete ' ;
107+ $ extra = '<input ' . drupal_attributes ($ attributes ) . ' /> ' ;
108+
109+ // Add form control feedback.
110+ $ icon = '<span class="fa fa-circle-o-notch form-control-feedback" aria-hidden="true"></span> ' ;
111+ $ output = $ output . $ icon ;
112+ }
113+
114+ return $ output . $ extra ;
115+ }
77116
78117/**
79118 * Implements theme_form_element().
@@ -121,6 +160,11 @@ function kalatheme_form_element($variables) {
121160 }
122161 else {
123162 $ attributes ['class ' ][] = 'form-group ' ;
163+
164+ //
165+ if (isset ($ element ['#autocomplete_path ' ]) && drupal_valid_path ($ element ['#autocomplete_path ' ])) {
166+ $ attributes ['class ' ][] = 'has-feedback ' ;
167+ }
124168 }
125169 }
126170
@@ -248,7 +292,7 @@ function kalatheme_textarea($variables) {
248292 if (isset ($ element ['#rows ' ])){
249293 $ element ['#attributes ' ]['rows ' ] = $ element ['#rows ' ];
250294 }
251- _form_set_class ($ element , array ('form-textarea ' , ' form-control ' ));
295+ _form_set_class ($ element , array ('form-textarea ' ));
252296
253297 $ wrapper_attributes = array (
254298 'class ' => array ('form-textarea-wrapper ' ),
0 commit comments