You are here

function svg_image_is_file_svg in Svg Image 8

Same name and namespace in other branches
  1. 2.x svg_image.module \svg_image_is_file_svg()
  2. 1.x svg_image.module \svg_image_is_file_svg()

Checks if current file is SVG image.

Parameters

\Drupal\file\Entity\File $file: File to check.

Return value

bool TRUE if is SVG, FALSE otherwise.

6 calls to svg_image_is_file_svg()
SvgImageFormatter::viewElements in src/Plugin/Field/FieldFormatter/SvgImageFormatter.php
Builds a renderable array for a field value.
SvgImageUrlFormatter::viewElements in src/Plugin/Field/FieldFormatter/SvgImageUrlFormatter.php
Builds a renderable array for a field value.
SvgImageWidget::process in src/Plugin/Field/FieldWidget/SvgImageWidget.php
Form API callback: Processes a file_generic field element.
SvgResponsiveImageFormatter::viewElements in modules/svg_image_responsive/src/Plugin/Field/FieldFormatter/SvgResponsiveImageFormatter.php
Builds a renderable array for a field value.
svg_image_get_image_file_dimensions in ./svg_image.module
Provides image file dimensions.

... See full list

File

./svg_image.module, line 108
Contains main functions and hooks for svg_image module.

Code

function svg_image_is_file_svg(File $file) {
  return $file
    ->getMimeType() === 'image/svg+xml';
}