public
Created

theming buttons in Drupal 7 - template.php

  • Download Gist
buttons
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
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']) . ' />';
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.