You are here

public function File::extensionGuesser in Bamboo Twig 8.5

Same name and namespace in other branches
  1. 8.2 bamboo_twig_file/src/TwigExtension/File.php \Drupal\bamboo_twig_file\TwigExtension\File::extensionGuesser()
  2. 8.3 bamboo_twig_file/src/TwigExtension/File.php \Drupal\bamboo_twig_file\TwigExtension\File::extensionGuesser()
  3. 8.4 bamboo_twig_file/src/TwigExtension/File.php \Drupal\bamboo_twig_file\TwigExtension\File::extensionGuesser()

Makes a best guess for a file extension, given a mime type.

Parameters

string $mime_type: The mime type.

Return value

string The guessed extension or NULL, if none could be guessed.

File

bamboo_twig_file/src/TwigExtension/File.php, line 59

Class

File
Provides a 'File' Twig Extensions.

Namespace

Drupal\bamboo_twig_file\TwigExtension

Code

public function extensionGuesser($mime_type) {
  $exts = $this
    ->getExtensionGuesser()
    ->getExtensions($mime_type);
  return $exts[0] ?? NULL;
}