X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/blobdiff_plain/afe8432c547383c5fb7a622ec32091ce300d6ad6..1b31d985327a0180e27bba6051c405db1ccae2ae:/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php
diff --git a/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php b/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php
index 9d5417fc4b51..1377dae28ef4 100644
--- a/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php
+++ b/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php
@@ -153,56 +153,46 @@ class FormEngineUtility {
}
/**
- * Get icon (for example for selector boxes)
+ * Renders the $icon, supports a filename for skinImg or sprite-icon-name
*
- * @param string $icon Icon reference
- * @return array Array with two values; the icon file reference, the icon file information array (getimagesize())
+ * @param string $icon The icon passed, could be a file-reference or a sprite Icon name
+ * @param string $alt Alt attribute of the icon returned
+ * @param string $title Title attribute of the icon return
+ * @return string A tag representing to show the asked icon
* @internal
*/
- static public function getIcon($icon) {
- $selIconFile = '';
- $selIconInfo = FALSE;
+ static public function getIconHtml($icon, $alt = '', $title = '') {
$icon = (string)$icon;
+ $iconFile = '';
+ $iconInfo = FALSE;
+
if (StringUtility::beginsWith($icon, 'EXT:')) {
$absoluteFilePath = GeneralUtility::getFileAbsFileName($icon);
if (!empty($absoluteFilePath)) {
- $selIconFile = '../' . PathUtility::stripPathSitePrefix($absoluteFilePath);
- $selIconInfo = (StringUtility::endsWith($absoluteFilePath, '.svg'))
+ $iconFile = '../' . PathUtility::stripPathSitePrefix($absoluteFilePath);
+ $iconInfo = (StringUtility::endsWith($absoluteFilePath, '.svg'))
? TRUE
: getimagesize($absoluteFilePath);
}
} elseif (StringUtility::beginsWith($icon, '../')) {
// @TODO: this is special modList, files from folders and selicon
- $selIconFile = GeneralUtility::resolveBackPath($icon);
+ $iconFile = GeneralUtility::resolveBackPath($icon);
if (is_file(PATH_site . GeneralUtility::resolveBackPath(substr($icon, 3)))) {
- $selIconInfo = (StringUtility::endsWith($icon, '.svg'))
+ $iconInfo = (StringUtility::endsWith($icon, '.svg'))
? TRUE
: getimagesize((PATH_site . GeneralUtility::resolveBackPath(substr($icon, 3))));
}
}
- if ($selIconInfo === FALSE) {
- // Unset to empty string if icon is not available
- $selIconFile = '';
- }
- return array($selIconFile, $selIconInfo);
- }
- /**
- * Renders the $icon, supports a filename for skinImg or sprite-icon-name
- *
- * @param string $icon The icon passed, could be a file-reference or a sprite Icon name
- * @param string $alt Alt attribute of the icon returned
- * @param string $title Title attribute of the icon return
- * @return string A tag representing to show the asked icon
- * @internal
- */
- static public function getIconHtml($icon, $alt = '', $title = '') {
- $iconArray = static::getIcon($icon);
- if (!empty($iconArray[0]) && is_file(GeneralUtility::resolveBackPath(PATH_typo3 . $iconArray[0]))) {
- return '
';
- } else {
- return IconUtility::getSpriteIcon($icon, array('alt' => $alt, 'title' => $title));
+ if ($iconInfo !== FALSE && is_file(GeneralUtility::resolveBackPath(PATH_typo3 . $iconFile))) {
+ return '
';
}
+
+ return IconUtility::getSpriteIcon($icon, array('alt' => $alt, 'title' => $title));
}
/**