Files
oai-symfony/typo3conf/ext/tt_address/Classes/ViewHelpers/RemoveSpacesViewHelper.php
2026-07-03 17:53:31 +02:00

40 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace FriendsOfTYPO3\TtAddress\ViewHelpers;
/**
* This file is part of the "tt_address" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
class RemoveSpacesViewHelper extends AbstractViewHelper
{
use CompileWithRenderStatic;
/**
* Initialize arguments
*/
public function initializeArguments()
{
$this->registerArgument('value', 'string', 'value');
}
/**
* @param array $arguments
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
* @return string
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
$value = $arguments['value'] ?: $renderChildrenClosure();
return str_replace(' ', '', $value);
}
}