I want to theme with css a specific button: the save or submit one.
I´m using Drupal 6 and according to the api´s instructions, I should add this to my template.tpl.php file, but that´s overriding all buttons… how can I target only submit button? Should I change $element['#button_type'] for $element['#submit']?
<?php
function theme_button($element) {
// Make sure not to overwrite classes.
if (isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = 'form-' . $element['#button_type'] . ' ' . $element['#attributes']['class'];
}
else {
$element['#attributes']['class'] = 'form-' . $element['#button_type'];
}
return '<input type="submit" ' . (empty($element['#name']) ? '' : 'name="' . $element['#name'] . '" ') . 'id="' . $element['#id'] . '" value="' . check_plain($element['#value']) . '" ' . drupal_attributes($element['#attributes']) . " />\n";
}
?>
Thanks for your help!!
Rosamunda
Sounds like the easiest way would be to create your own button theming function (as you’re doing now), check what type of button is being drawn, and just call the original theme function from inside your own function if it’s not a submit button.