function theme_button

Returns HTML for a button form element.

Parameters

$variables: An associative array containing:

  • element: An associative array containing the properties of the element. Properties used: #attributes, #button_type, #name, #value.

The #button_type property accepts any value, though core themes have css that styles the following button_types appropriately: 'primary', 'danger'.

Related topics

1 theme call to theme_button()
theme_submit in drupal/core/includes/form.inc
Returns HTML for a submit button form element.

File

drupal/core/includes/form.inc, line 3955
Functions for form and batch generation and processing.

Code

function theme_button($variables) {
  $element = $variables['element'];
  $element['#attributes']['type'] = 'submit';
  element_set_attributes($element, array(
    'id',
    'name',
    'value',
  ));
  $element['#attributes']['class'][] = 'form-button';
  if (!empty($element['#button_type'])) {
    $element['#attributes']['class'][] = 'form-button-' . $element['#button_type'];
  }

  // @todo Various JavaScript depends on this button class.
  $element['#attributes']['class'][] = 'form-submit';
  if (!empty($element['#attributes']['disabled'])) {
    $element['#attributes']['class'][] = 'form-button-disabled';
  }
  return '<input' . new Attribute($element['#attributes']) . ' />';
}