From: Johannes Feustel Date: Sat, 18 Aug 2012 11:34:49 +0000 (+0200) Subject: [FEATURE] Allow ext_icon.png as extension icon besides ext_icon.gif X-Git-Tag: TYPO3_6-0-0beta1~114 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/3358716ad369d87144987a0f40026f1b25dcd281 [FEATURE] Allow ext_icon.png as extension icon besides ext_icon.gif Search for ext_icon.png and ext_icon.gif and store to $GLOBALS['TYPO3_LOADED_EXT'][$_EXTKEY]['ext_icon'] Change-Id: I4867ba9c46b3c9d1674d91313599b2aada5e9295 Resolves: #37595 Releases: 6.0 Reviewed-on: http://review.typo3.org/13888 Reviewed-by: Philipp Gampe Tested-by: Philipp Gampe Reviewed-by: Wouter Wolters Tested-by: Wouter Wolters Reviewed-by: Christian Kuhn Tested-by: Christian Kuhn --- diff --git a/t3lib/class.t3lib_extmgm.php b/t3lib/class.t3lib_extmgm.php index 7b1049a926cd..45065ce21951 100644 --- a/t3lib/class.t3lib_extmgm.php +++ b/t3lib/class.t3lib_extmgm.php @@ -1315,7 +1315,8 @@ class t3lib_extMgm { public static function addPlugin($itemArray, $type = 'list_type') { $_EXTKEY = $GLOBALS['_EXTKEY']; if ($_EXTKEY && !$itemArray[2]) { - $itemArray[2] = self::extRelPath($_EXTKEY) . 'ext_icon.gif'; + $itemArray[2] = self::extRelPath($_EXTKEY) . + $GLOBALS['TYPO3_LOADED_EXT'][$_EXTKEY]['ext_icon']; } t3lib_div::loadTCA('tt_content'); @@ -1624,11 +1625,38 @@ tt_content.' . $key . $prefix . ' { } } } + // Register found extension icon + $loadedExtensionInformation[$extensionKey]['ext_icon'] = self::getExtensionIcon(PATH_site . $loadedExtensionInformation[$extensionKey]['siteRelPath']); } return $loadedExtensionInformation; } + /** + * Find extension icon + * + * @param string $extensionPath Path to extension directory. + * @param string $returnFullPath Return full path of file. + * @return string + * @throws BadFunctionCallException + */ + public static function getExtensionIcon($extensionPath, $returnFullPath = FALSE){ + $icon = ''; + $iconFileTypesToCheckFor = array( + 'png', + 'gif', + ); + + foreach ($iconFileTypesToCheckFor as $fileType){ + if (@is_file($extensionPath . 'ext_icon.' . $fileType)) { + $icon = 'ext_icon.' . $fileType; + break; + } + } + + return $returnFullPath ? $extensionPath . $icon : $icon; + } + /** * Cache identifier of cached Typo3LoadedExtensionInformation array * diff --git a/typo3/db_new.php b/typo3/db_new.php index 1ef657462b2a..4414d84bfd70 100644 --- a/typo3/db_new.php +++ b/typo3/db_new.php @@ -503,7 +503,8 @@ class SC_db_new { include(t3lib_extMgm::extPath($_EXTKEY) . 'ext_emconf.php'); $thisTitle = $EM_CONF[$_EXTKEY]['title']; } - $iconFile[$_EXTKEY] = ''; + $iconFile[$_EXTKEY] = ''; } else { $thisTitle = $nameParts[1]; $iconFile[$_EXTKEY] = ''; diff --git a/typo3/sysext/extensionmanager/Classes/Utility/List.php b/typo3/sysext/extensionmanager/Classes/Utility/List.php index c587fa0acbe2..67e52ee6a3d3 100644 --- a/typo3/sysext/extensionmanager/Classes/Utility/List.php +++ b/typo3/sysext/extensionmanager/Classes/Utility/List.php @@ -107,7 +107,8 @@ class Tx_Extensionmanager_Utility_List implements t3lib_Singleton { $extensions[$extKey] = array( 'siteRelPath' => str_replace(PATH_site, '', $path . $extKey), 'type' => $installationType, - 'key' => $extKey + 'key' => $extKey, + 'ext_icon' => t3lib_extMgm::getExtensionIcon( $path . $extKey . '/'), ); } } @@ -120,7 +121,7 @@ class Tx_Extensionmanager_Utility_List implements t3lib_Singleton { } /** - * Reduce the available extensions list to only installed extensions + * Reduce the available extensions list to only loaded extensions * * @param array $availableExtensions * @return array diff --git a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Index.html b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Index.html index 3ac558d49195..d0435eb1be52 100644 --- a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Index.html +++ b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Index.html @@ -57,7 +57,7 @@ - {extension.title} + {extension.title} {extensionKey}