diff --git a/includes/form.inc b/includes/form.inc index a74bf46..1a27a1d 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -124,22 +124,18 @@ function _radix_text_format_after_build($element, &$form_state) { $format = &$element['format']['format']; // Set title to show as a field_prefix if there is no field_prefix set. + // @todo: Affects accessibility because no longer have the title in a label! $format['#field_prefix'] = empty($format['#field_prefix']) ? $format['#title'] : $format['#field_prefix']; unset($format['#title']); - $format['#theme_wrappers'] = array_map( - function($function) { - // Overrides only form_element wrapper. - if ($function == 'form_element') { - return 'input_group'; - } - // But leaves the other wrappers in place. - else { - return $function; - } - }, - $format['#theme_wrappers']); + // Overrides the form_element wrapper to render as an input group. + foreach ($format['#theme_wrappers'] as $index => $function) { + if ($function == 'form_element') { + $format['#theme_wrappers'][$index] = 'radix_input_group'; + } + } + return $element; } diff --git a/includes/theme.inc b/includes/theme.inc index 2622872..3f3f06a 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -68,13 +68,15 @@ function radix_theme(&$existing, $type, $theme, $path) { ), 'function' => 'theme_radix_icon', ), - 'input_group' => array( + 'radix_input_group' => array( 'render element' => 'element', + 'function' => 'theme_radix_input_group', ), - 'input_group_addon' => array( + 'radix_input_group_addon' => array( 'variables' => array( 'content' => NULL, ), + 'function' => 'theme_radix_input_group_addon', ) ); } @@ -395,7 +397,7 @@ function theme_radix_icon($variables) { /** * Implements template_preprocess_input_group(). */ -function radix_preprocess_input_group(&$variables) { +function radix_preprocess_radix_input_group(&$variables) { $element = &$variables['element']; // Add element #id for #type 'item'. @@ -437,7 +439,7 @@ function radix_preprocess_input_group(&$variables) { /** * Implements theme_input_group(). */ -function radix_input_group($variables) { +function theme_radix_input_group($variables) { $element = $variables['element']; $output = '