You are here

function svg_image_field_preprocess_image_style in SVG Image Field 2.0.x

Same name and namespace in other branches
  1. 2.1.x svg_image_field.module \svg_image_field_preprocess_image_style()

Prepares variables for image style templates.

See also

template_preprocess_image_style()

File

./svg_image_field.module, line 143
Contains svg_image_field.module.

Code

function svg_image_field_preprocess_image_style(array &$variables) {
  if (isset($variables['image']['#access']) && !$variables['image']['#access']) {
    $extension = pathinfo($variables['uri'], PATHINFO_EXTENSION);
    $extension = mb_strtolower($extension);
    if ($extension === 'svg') {
      $variables['image']['#access'] = TRUE;
      $variables['image']['#attributes']['class'] = 'no-image-style';
    }
  }
}