function theme_image_widget

7.x image.field.inc theme_image_widget($variables)

Returns HTML for an image field widget.

Parameters

$variables: An associative array containing:

  • element: A render element representing the image field widget.

Related topics

2 string references to the theme hook from theme_image_widget()

Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.

image_field_widget_process in drupal/modules/image/image.field.inc
An element #process callback for the image_image field type.
image_theme in drupal/modules/image/image.module
Implements hook_theme().

File

drupal/modules/image/image.field.inc, line 454
Implement an image field, based on the file module's file field.

Code

function theme_image_widget($variables) {
  $element = $variables['element'];
  $output = '';
  $output .= '<div class="image-widget form-managed-file clearfix">';

  if (isset($element['preview'])) {
    $output .= '<div class="image-preview">';
    $output .= drupal_render($element['preview']);
    $output .= '</div>';
  }

  $output .= '<div class="image-widget-data">';
  if ($element['fid']['#value'] != 0) {
    $element['filename']['#markup'] .= ' <span class="file-size">(' . format_size($element['#file']->filesize) . ')</span> ';
  }
  $output .= drupal_render_children($element);
  $output .= '</div>';
  $output .= '</div>';

  return $output;
}