You are here

private function Common::mimeIcon in Filebrowser 8.2

Same name and namespace in other branches
  1. 3.x src/Services/Common.php \Drupal\filebrowser\Services\Common::mimeIcon()

Returns a string containing the mime type of the file. This will be used to identify the file icon. Returns 'unknown' for mime types that have no icon.

Parameters

string $mime_type:

Return value

string

1 call to Common::mimeIcon()
Common::iconGenerate in src/Services/Common.php
You can override the icons used by providing your own in theme/active_theme/filebrowser

File

src/Services/Common.php, line 406

Class

Common
Class Common @package Drupal\filebrowser\Services

Namespace

Drupal\filebrowser\Services

Code

private function mimeIcon($mime_type) {
  if ($mime_type == 'folder/parent') {
    return 'folder-parent';
  }
  $parts = explode('/', $mime_type);
  switch ($parts[0]) {
    case 'video':
    case 'image':
    case 'audio':
    case 'text':
      $mime = $parts[0];
      break;
    case 'application':
      $mime = $this
        ->applicationMimeIcon($parts[1]);
      break;
    default:
      $mime = 'unknown';
  }
  return $mime;
}