Skip to content
Create a gist now

Instantly share code, notes, and snippets.

theming buttons in Drupal 7 - template.php
function theme_button($variables) {
$element = $variables['element'];
$element['#attributes']['type'] = 'submit';
element_set_attributes($element, array('id', 'name', 'value'));
$element['#attributes']['class'][] = 'form-' . $element['#button_type'];
if (!empty($element['#attributes']['disabled'])) {
$element['#attributes']['class'][] = 'form-button-disabled';
//custom class
$element['#attributes']['class'][] = 'button';
$element['#attributes']['class'][] = 'small';
return '<input' . drupal_attributes($element['#attributes']) . ' />';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.