public function AssetImageHelper::getGenericMediaIcon in Media: Acquia DAM 8
Gets a generic file icon based on mimetype.
Parameters
array $mimetype: An array of a discrete type and a subtype.
Return value
bool|string A path to a generic filetype icon or FALSE on failure.
1 call to AssetImageHelper::getGenericMediaIcon()
- AssetImageHelper::getThumbnail in src/
Service/ AssetImageHelper.php - Get the thumbnail for the given asset.
File
- src/
Service/ AssetImageHelper.php, line 332
Class
- AssetImageHelper
- Class AssetImageHelper.
Namespace
Drupal\media_acquiadam\ServiceCode
public function getGenericMediaIcon(array $mimetype) {
$icon_base = $this->configFactory
->get('media.settings')
->get('icon_base_uri');
$generic_paths = [
sprintf('%s/%s-%s.png', $icon_base, $mimetype['discrete'], $mimetype['sub']),
sprintf('%s/%s.png', $icon_base, $mimetype['sub']),
sprintf('%s/generic.png', $icon_base),
];
foreach ($generic_paths as $generic_path) {
if ($this
->phpFileExists($generic_path)) {
return $generic_path;
}
}
return FALSE;
}