You are here

function iss_preprocess_field in Image Style Selector 7.2

Implements hook_preprocess_field().

File

./iss.module, line 315

Code

function iss_preprocess_field(&$vars) {
  if (variable_get('iss_apply_method', 'default') == 'default') {
    $element = $vars['element'];
    $items =& $vars['items'];
    if ($element['#field_type'] == 'image') {
      foreach ($items as $delta => &$item) {
        $file = $item['#item'];
        $image_style =& $item['#image_style'];
        if (!empty($file['iss_styles'])) {
          foreach ($file['iss_styles'] as $source => $target) {
            if ($image_style == $source) {
              $image_style = $target;
            }
          }
        }
      }
    }
  }
}