You are here

function manualcrop_field_widget_info_alter in Manual Crop 7

Implements hook_field_widget_info_alter().

File

./manualcrop.module, line 212

Code

function manualcrop_field_widget_info_alter(&$info) {
  foreach (manualcrop_supported_widgets() as $widget_type) {
    if (isset($info[$widget_type]['settings'])) {
      $settings =& $info[$widget_type]['settings'];
      $settings += manualcrop_default_widget_settings();
      if ($settings['manualcrop_styles_mode'] == 'exclude' && !empty($settings['manualcrop_styles_list'])) {

        // Check if all styles are excluded.
        $styles = manualcrop_styles_with_crop();
        $styles = array_diff_key($styles, $settings['manualcrop_styles_list']);
        if (empty($styles)) {
          $settings['manualcrop_enable'] = FALSE;
        }
      }
    }
  }
}