* ....
*
*
*
* @api
*/
class PublicPathViewHelper extends AbstractViewHelper
{
use CompileWithRenderStatic;
/**
* @var bool
*/
protected $escapeOutput = false;
public function initializeArguments(): void
{
parent::initializeArguments();
$this->registerArgument('path', 'string', 'Extension resource path', true);
}
public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
): string {
$path = (string)$arguments['path'];
try {
$path = PathUtility::getPublicResourceWebPath($path);
} catch (\Exception) {
$path = '';
}
return $path;
}
}