You are here

function theme_file_styles_image_style_preview in Styles 7

Same name and namespace in other branches
  1. 7.2 contrib/file_styles/file_styles.theme.inc \theme_file_styles_image_style_preview()

A wrapper for the image style preview.

File

contrib/file_styles/file_styles.theme.inc, line 11
Theme functions for File styles.

Code

function theme_file_styles_image_style_preview($variables) {
  $style_name = $variables['style_name'];
  $styles = image_styles();
  if (isset($styles[$style_name])) {

    // The theme_image_style_preview function is in image.admin,
    // but not properly referenced in hook_theme.
    // @TODO: File a bug report and fix this in core.
    module_load_include('inc', 'image', 'image.admin');
    drupal_add_css(drupal_get_path('module', 'image') . '/image.admin.css');

    // Ensure we revert the module & storage namespace for the Image module.
    if (isset($styles[$style_name]['image_module'])) {
      $styles[$style_name]['module'] = $styles[$style_name]['image_module'];
      $styles[$style_name]['storage'] = $styles[$style_name]['image_storage'];
    }
    return theme('image_style_preview', array(
      'style' => $styles[$style_name],
    ));
  }
}