Skip to content
Snippets Groups Projects
Commit 1bda697f authored by Benni Mack's avatar Benni Mack Committed by Wouter Wolters
Browse files

[TASK] IconViewHelper should generate absolute URLs

This change allows the IconViewHelper in the reports module
to be used not just from typo3/ (e.g. if a person puts typo3/index.php
to a different place or wants to show the reports in the install tool).

Resolves: #76322
Releases: master
Change-Id: I7067654b3fff5ac75fb9883b708ddb28a9ddc7d1
Reviewed-on: https://review.typo3.org/48321


Reviewed-by: default avatarMorton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: default avatarMorton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: default avatarFrank Naegler <frank.naegler@typo3.org>
parent a3a261e1
Branches
Tags
No related merge requests found
...@@ -14,8 +14,8 @@ namespace TYPO3\CMS\Reports\ViewHelpers; ...@@ -14,8 +14,8 @@ namespace TYPO3\CMS\Reports\ViewHelpers;
* The TYPO3 project - inspiring people to share! * The TYPO3 project - inspiring people to share!
*/ */
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
use TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper; use TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
...@@ -64,14 +64,7 @@ class IconViewHelper extends AbstractBackendViewHelper ...@@ -64,14 +64,7 @@ class IconViewHelper extends AbstractBackendViewHelper
$icon = $arguments['icon']; $icon = $arguments['icon'];
$title = $arguments['title']; $title = $arguments['title'];
if (!empty($icon)) { $icon = GeneralUtility::getFileAbsFileName($icon ?: 'EXT:reports/ext_icon.png');
$absIconPath = GeneralUtility::getFileAbsFileName($icon); return '<img src="' . htmlspecialchars(PathUtility::getAbsoluteWebPath($icon)) . '" width="16" height="16" title="' . htmlspecialchars($title) . '" alt="' . htmlspecialchars($title) . '" />';
if (file_exists($absIconPath)) {
$icon = '../' . str_replace(PATH_site, '', $absIconPath);
}
} else {
$icon = ExtensionManagementUtility::extRelPath('reports') . 'ext_icon.png';
}
return '<img src="' . htmlspecialchars($icon) . '" width="16" height="16" title="' . htmlspecialchars($title) . '" alt="' . htmlspecialchars($title) . '" />';
} }
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment