You are here

function imagecrop_get_enabled_styles_for_crop in Image javascript crop 7

Get all the enabled styles for the current crop url.

2 calls to imagecrop_get_enabled_styles_for_crop()
imagecrop_cropping_page in includes/imagecrop.admin.inc
Show the cropping page for the selected image style.
imagecrop_image_styles_overview in includes/imagecrop.admin.inc
Show an overview from the enabled image styles for this file. Show an example from the first (or selected) image.

File

includes/imagecrop.admin.inc, line 548
Administration tools for the imagecrop module.

Code

function imagecrop_get_enabled_styles_for_crop($entity_type, $bundle, $field_name) {
  $enabled_styles = array();
  if ($entity_type && $bundle && $field_name) {
    $enabled_styles = imagecrop_get_fields_enabled_styles($entity_type, $field_name, $bundle);
  }
  $styles = get_imagecrop_styles($enabled_styles);
  if (count($styles) == 0) {
    drupal_set_message(t('No javascript crop image styles are enabled for the current field.'), 'error');
    throw new Exception('No preset is found with the javascript_crop action so far. If you want to take advantage of this module, you will need to create at least one preset with that action.');
  }
  return $styles;
}