* Link
*
*
*/
class TargetLinkViewHelper extends AbstractViewHelper implements ViewHelperInterface
{
use CompileWithRenderStatic;
/**
* Initialize arguments.
*/
public function initializeArguments()
{
parent::initializeArguments();
$this->registerArgument('link', 'string', 'Link', true);
}
/**
* Returns the correct target of a typolink
*
* @param array $arguments
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
* @return mixed
*/
public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
) {
$params = explode(' ', $arguments['link']);
// The target is on the 2nd place and must start with a '_'
if (count($params) >= 2 && substr($params[1], 0, 1) === '_') {
return $params[1];
}
return '';
}
}