theme_image_button

6 form.inc theme_image_button($element)
7 form.inc theme_image_button($variables)
8 form.inc theme_image_button($variables)

Theme a form image button.

Related topics

File

includes/form.inc, line 1987

Code

function theme_image_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="image" name="' . $element['#name'] . '" ' .
    (!empty($element['#value']) ? ('value="' . check_plain($element['#value']) . '" ') : '') .
    'id="' . $element['#id'] . '" ' .
    drupal_attributes($element['#attributes']) .
    ' src="' . base_path() . $element['#src'] . '" ' .
    (!empty($element['#title']) ? 'alt="' . check_plain($element['#title']) . '" title="' . check_plain($element['#title']) . '" ' : '' ) .
    "/>\n";
}

Comments

External images cannot be used

The image location (#src attribute) should be relative to the Drupal base directory. External images cannot be used in the Drupal 6 version of this function, as noted in the issue:
http://drupal.org/node/563336

Login or register to post comments