You are here

function theme_imagefield_crop_widget in Imagefield Crop 7

Same name and namespace in other branches
  1. 6 imagefield_crop_widget.inc \theme_imagefield_crop_widget()
  2. 7.3 theme/theme.inc \theme_imagefield_crop_widget()
  3. 7.2 imagefield_crop.module \theme_imagefield_crop_widget()

@file Themeable functions for imagefield_crop module.

File

./imagefield_crop.theme.inc, line 8
Themeable functions for imagefield_crop module.

Code

function theme_imagefield_crop_widget($variables) {
  $element = $variables['element'];
  $wrapper_attributes = array(
    'class' => array(
      'imagefield-crop-widget',
      'form-managed-file',
      'clearfix',
    ),
  );
  $output = '';
  if (isset($element['preview'])) {
    $element['preview']['#attributes']['class'][] = 'form-item';
    $element['preview']['#attributes']['class'][] = 'imagefield-crop-preview';
    $output .= '<div ' . drupal_attributes($element['preview']['#attributes']) . '>';
    $output .= drupal_render($element['preview']);
    $output .= '<div class="description">' . $element['preview']['#description'] . '</div>';
    $output .= '</div>';
  }
  if (isset($element['cropbox'])) {
    $element['cropbox']['#attributes']['class'][] = 'form-item';
    $element['cropbox']['#attributes']['class'][] = 'imagefield-crop-cropbox';
    $output .= '<div ' . drupal_attributes($element['cropbox']['#attributes']) . '>';
    $output .= drupal_render($element['cropbox']);
    $output .= '<div class="description">' . $element['cropbox']['#description'] . '</div>';
    $output .= '</div>';
  }
  $output .= drupal_render_children($element);
  return '<div ' . drupal_attributes($wrapper_attributes) . '>' . $output . '</div>';
}