ew_base/Classes/User/AssetPath.php
2024-12-26 21:44:19 +01:00

37 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
/*
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\User;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
/**
* EXAMPLE:
* page.headerData.10 = USER
* page.headerData.10.userFunc = Evoweb\EwBase\User\AssetPath->getAbsolutePublicPath
* page.headerData.10.file = EXT:site_package/Resources/Public/manifest.json
* page.headerData.10.stdWrap.wrap = <link rel="manifest" href="|"/>
*/
class AssetPath
{
public function getAbsolutePublicPath(string $content, array $conf): string
{
return $content
. GeneralUtility::getIndpEnv('TYPO3_SITE_URL')
. ltrim(PathUtility::getPublicResourceWebPath($conf['file']), '/');
}
}