You are here

function get_imagecrop_styles in Image javascript crop 7

Return a list of presets.

Parameters

$enabled_styles array of styles that are enabled for a field:

Return value

$presets array with presetid to load and list of all other possible presets.

7 calls to get_imagecrop_styles()
imagecrop_form_field_ui_field_edit_form_alter in ./imagecrop.module
Implements hook_form_field_ui_field_edit_form_alter(). Add the imagecrop setting to an imagefield.
imagecrop_form_file_entity_edit_alter in ./imagecrop.module
Implements hook_form_file_entity_edit_alter(). Add imagecrop to file_entity edit form.
imagecrop_form_user_profile_form_alter in ./imagecrop.module
Implements hook_form_user_profile_form_alter(). Add imagecrop to profile picture, if enabled.
imagecrop_get_enabled_styles_for_crop in includes/imagecrop.admin.inc
Get all the enabled styles for the current crop url.
imagecrop_process_form_element in ./imagecrop.module
Process function for imagecrop-enabled fields.

... See full list

File

./imagecrop.module, line 599
Provides a javascript toolbox through an imagecache action.

Code

function get_imagecrop_styles($enabled_styles = array()) {
  $apply_filter = count($enabled_styles) > 0;
  $all_styles = image_styles();
  $styles = array();
  foreach ($all_styles as $machine_name => $style) {
    foreach ($style['effects'] as $effect) {
      if ($effect['name'] == 'imagecrop_javascript') {

        // Skip if current style is not enabled.
        if ($apply_filter && !in_array($machine_name, $enabled_styles)) {
          continue;
        }

        // $style['label'] introduced in Drupal 7.23
        $styles[$machine_name] = isset($style['label']) ? $style['label'] : t($style['name']);
      }
    }
  }
  return $styles;
}