By markhalliwell on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
7.x-4.x
Introduced in version:
7.x-4.0-rc5
Issue links:
Description:
Previously, theme_webform_element() was doing too much preprocessing of theme variables directly instead the theme function's output. This prevented themes the ability to effectively alter the wrapper classes (specifically the removal of classes). Such functionality has been moved to a proper template_preprocess_webform_element function() function.
If any of your themes or base-themes have overridden the theme_webform_element() function in the past, please update them accordingly.
Below is a simplified example of this upgrade process:
Before:
/**
* Overrides theme_webform_element().
*/
function YOURTHEME_webform_element($variables) {
$variables['element']['#wrapper_attributes']['class'][] = 'my-custom-class';
return theme_webform_element($variables);
}
After:
/**
* Implements hook_preprocess_webform_element().
*/
function YOURTHEME_preprocess_webform_element(&$variables) {
$variables['element']['#wrapper_attributes']['class'][] = 'my-custom-class';
}
Impacts:
Themers
Comments
A minor suggestion...
How about changing "overridden this theme function" to read "overridden the theme_webform_element() function" for clarity?
I realize this should be obvious, but it might not be the case for someone new to Drupal/Webform theming. Just a thought--I'm pretty happy about this patch! :)