Tested on:
Customizing Drupal form appearance may sound difficult. But to add a CSS class is (surprisingly!) simple using theme_fieldset themeable function.
I’ve attached an example to generate CSS class from fieldset title: Add CSS class to drupal form fieldset.
=> Add CSS class to drupal form fieldset
# custom fieldset CSS class from element #title
$css_class = “my-custom-class-“;
$css_class .= str_replace(” “,”-“,strtolower($element[‘#title’]));
# using transliteration module to transliterate/strip non-ASCII character where available
if(module_exists(‘transliteration’)){
# including Transliteration functions
require_once(drupal_get_path(‘module’, ‘transliteration’) .’/transliteration.inc’);
$css_class = transliteration_clean_filename($css_class);
}
Adding this code to your template:
I apply a previous substitution of whitespace using “-” (transliteration module use underscore “_”) and you can do the same, but later remember to use transliteration_clean_filename to safely sanitize class name for any other case you’ve not contemplated (accents, special characters).
=> https://web.archive.org/web/20080317000000*/http://api.drupal.org/api/function/theme_fieldset/5 | https://web.archive.org/web/20080317000000*/http://api.drupal.org/api/function/theme_fieldset/5 | https://web.archive.org/web/20080317000000*/http://drupal.org/phptemplate This content has been proxied by September (ba2dc).Proxy Information
text/gemini; charset=utf-8