You are here

function resp_img_image_styles_alter in Responsive images and styles 7.2

Implements hook_image_styles_alter().

File

./resp_img.module, line 594

Code

function resp_img_image_styles_alter(&$styles) {
  $breakpoint_groups = breakpoints_breakpoint_group_load_all();
  if ($breakpoint_groups && !empty($breakpoint_groups)) {
    foreach ($breakpoint_groups as $machine_name => $breakpoint_group) {
      $mapping = _resp_img_get_breakpoint_styles($machine_name);
      $first_style = FALSE;
      if (!empty($mapping)) {
        $first_mapping = reset($mapping['mapping']);
        $first_style = reset($first_mapping);
      }
      if ($first_style) {
        $first_style = isset($styles[$first_style]) ? $styles[$first_style] : FALSE;
      }
      if ($first_style) {
        $new_effects = array();
        foreach ($first_style['effects'] as $effect) {
          $new_effect = $effect;
          unset($new_effect['isid']);
          unset($new_effect['ieid']);
          $new_effects[] = $new_effect;
        }
        $styles[RESP_IMG_STYLE_PREFIX . $machine_name]['effects'] = $new_effects;
      }
    }
  }
}