Files
kupshop/class/smarty_plugins/function.static_url.php
2025-08-02 16:30:27 +02:00

22 lines
465 B
PHP

<?php
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;
use KupShop\KupShopBundle\Util\System\UrlFinder;
function smarty_function_static_url($params)
{
$url = $params['url'] ?? '';
static $urlFinder = null;
if (!$urlFinder) {
$urlFinder = ServiceContainer::getService(UrlFinder::class);
}
if ($params['absolute'] ?? false) {
return $urlFinder->staticUrlAbsolute($url);
}
return $urlFinder->staticUrl($url);
}