diff --git a/html/typo3conf/ext/ter_fe2/Classes/Solr/Indexqueue/TerIndexer.php b/html/typo3conf/ext/ter_fe2/Classes/Solr/Indexqueue/TerIndexer.php index 302404f8316fb7954d05e0202df6554654e7d1da..03b66deea3832247ba62654ffab48f6eec820b3f 100644 --- a/html/typo3conf/ext/ter_fe2/Classes/Solr/Indexqueue/TerIndexer.php +++ b/html/typo3conf/ext/ter_fe2/Classes/Solr/Indexqueue/TerIndexer.php @@ -165,26 +165,25 @@ class TerIndexer extends \ApacheSolrForTypo3\Solr\IndexQueue\Indexer */ protected function getExtensionIcon($extensionKey, $extensionVersion) { - - // check if there is a gif or a png icon or if there is no icon - $iconFilePng = $this->generateIconFileName( - $extensionKey, - $extensionVersion, - 'png' - ); - $iconFileGif = $this->generateIconFileName( - $extensionKey, - $extensionVersion, + $fileTypesToCheck = [ + 'svg', + 'png', 'gif' - ); + ]; $iconPath = 'fileadmin/ter/'; $icon = ''; - if (file_exists(PATH_site.$iconPath.$iconFilePng)) { - $icon = \T3o\TerFe2\Utility\File::getRelativeUrlFromAbsolutePath($iconPath.$iconFilePng); - } elseif (file_exists(PATH_site.$iconPath.$iconFileGif)) { - $icon = \T3o\TerFe2\Utility\File::getRelativeUrlFromAbsolutePath($iconPath.$iconFileGif); + foreach ($fileTypesToCheck as $fileType) { + $iconFile = $this->generateIconFileName( + $extensionKey, + $extensionVersion, + $fileType + ); + if (file_exists(PATH_site . $iconPath . $iconFile)) { + $icon = \T3o\TerFe2\Utility\File::getRelativeUrlFromAbsolutePath($iconPath . $iconFile); + break; + } } return $icon; diff --git a/html/typo3conf/ext/ter_fe2/Classes/ViewHelpers/ExtensionIconViewHelper.php b/html/typo3conf/ext/ter_fe2/Classes/ViewHelpers/ExtensionIconViewHelper.php index 36a113066c5773adecf6a207e937d81930d5ff33..669485b0cc0c98a65016d6f4dc6e659980f8c449 100755 --- a/html/typo3conf/ext/ter_fe2/Classes/ViewHelpers/ExtensionIconViewHelper.php +++ b/html/typo3conf/ext/ter_fe2/Classes/ViewHelpers/ExtensionIconViewHelper.php @@ -42,6 +42,15 @@ class ExtensionIconViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractT */ protected $providerManager; + /** + * @var array + */ + protected $fileIconOrder = [ + 'svg', + 'png', + 'gif' + ]; + /** * Initialize arguments * @@ -59,10 +68,9 @@ class ExtensionIconViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractT * Renders an extension icon for given version object * * @param \T3o\TerFe2\Domain\Model\Version $version Version object - * @param string $fileType File type * @return string Rendered image tag */ - public function render(\T3o\TerFe2\Domain\Model\Version $version = null, $fileType = 'png') + public function render(\T3o\TerFe2\Domain\Model\Version $version = null) { if ($version === null) { $version = $this->renderChildren(); @@ -71,9 +79,11 @@ class ExtensionIconViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractT $imageUrl = ''; $provider = $version->getExtensionProvider(); if (!empty($provider)) { - $imageUrl = $this->providerManager->getProvider($provider)->getIconUrl($version, $fileType); - if (empty($imageUrl) || !file_exists(\T3o\TerFe2\Utility\File::getAbsolutePathFromUrl($imageUrl))) { - $imageUrl = $this->providerManager->getProvider($provider)->getIconUrl($version, 'gif'); + foreach ($this->fileIconOrder as $fileType) { + $imageUrl = $this->providerManager->getProvider($provider)->getIconUrl($version, $fileType); + if (!empty($imageUrl) && file_exists(\T3o\TerFe2\Utility\File::getAbsolutePathFromUrl($imageUrl))) { + break; + } } }