17 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
59 parent::initializeArguments();
60 $this->registerArgument(
'uri',
'string',
'The URI that will be put in the href attribute of the rendered link tag',
true);
61 $this->registerArgument(
'defaultScheme',
'string',
'Scheme the href attribute will be prefixed with if specified $uri does not contain a scheme already',
false,
'http');
62 $this->registerUniversalTagAttributes();
63 $this->registerTagAttribute(
'name',
'string',
'Specifies the name of an anchor');
64 $this->registerTagAttribute(
'rel',
'string',
'Specifies the relationship between the current document and the linked document');
65 $this->registerTagAttribute(
'rev',
'string',
'Specifies the relationship between the linked document and the current document');
66 $this->registerTagAttribute(
'target',
'string',
'Specifies where to open the linked document');
74 $uri = $this->arguments[
'uri'];
75 $defaultScheme = $this->arguments[
'defaultScheme'];
77 $scheme = parse_url($uri, PHP_URL_SCHEME);
78 if ($scheme ===
null && $defaultScheme !==
'') {
79 $uri = $defaultScheme .
'://' . $uri;
81 $this->tag->addAttribute(
'href', $uri);
82 $this->tag->setContent($this->renderChildren());
83 $this->tag->forceClosingTag(
true);
85 return $this->tag->render();