You are here

function theme_imagefield_crop_formatter_uncropped in Imagefield Crop 6

Theme function to refactor the field element to use the uncropped file in the imagecache formatter.

Parameters

$element: The field element.

$function: The theme function that should process the reformatted element.

Return value

The themed output from $function.

1 string reference to 'theme_imagefield_crop_formatter_uncropped'
imagefield_crop_theme in ./imagefield_crop.module
Implementation of hook_theme().

File

./imagefield_crop.module, line 235

Code

function theme_imagefield_crop_formatter_uncropped($element, $function = '') {

  // Get the appropriate theme function name, if empty. Can't do anything
  // if there is no function name.
  if ($function || ($function = _imagefield_crop_formatter_theme_function($element['#formatter']))) {

    // Change the filepath for the item.
    $element['#item']['filepath'] = imagefield_crop_file_admin_crop_display_path($element['#item']);

    // Remove '_uncropped' from the formatter.
    $element['#formatter'] = substr($element['#formatter'], 0, -10);

    // Use function if specified, otherwise hack together the imagecache one.
    $element['#theme'] = $function ? $function : 'theme_imagecache_' . $element['#formatter'];

    // Should this call via 'theme($function, ...)' instead?
    return $function($element);
  }
}