LinkResult implements LinkResultInterface, Stringable, JsonSerializable
This class represents a created link to a resource (page, email etc.), coming from LinkService.
After it was executed by the LinkBuilders (mostly in Frontend) after it is called from Typolink.
Table of Contents
Interfaces
- LinkResultInterface
- Interface representing a created link to any type (page, file etc).
- Stringable
- JsonSerializable
Constants
- STRING_CAST_HTML = 1
- STRING_CAST_JSON = 2
Properties
- $additionalAttributes : array<string|int, mixed>
- $flags : int
- $linkConfiguration : array<string|int, mixed>
- $linkText : string|null
- $target : string
- $type : string
- $url : string
Methods
- __construct() : mixed
- __toString() : string
- adapt() : self
- Use this method to create a new LinkResult for a specific output format (HTML or JSON)
- getAttribute() : string|null
- getAttributes() : array<string|int, mixed>
- getHtml() : string
- getJson() : string
- getLinkConfiguration() : array<string, string>
- getLinkText() : string|null
- getTarget() : string
- getType() : string
- getUrl() : string
- hasAttribute() : bool
- jsonSerialize() : array<string|int, mixed>
- toArray() : array{href: ?string, target: ?string, class: ?string, title: ?string, linkText: ?string, additionalAttributes: array}
- withAttribute() : self
- withAttributes() : self
- withFlags() : self
- withLinkConfiguration() : self
- withLinkText() : self
- withTarget() : self
- filterAdditionalAttributes() : array<string|int, mixed>
Constants
STRING_CAST_HTML
public
mixed
STRING_CAST_HTML
= 1
STRING_CAST_JSON
public
mixed
STRING_CAST_JSON
= 2
Properties
$additionalAttributes
protected
array<string|int, mixed>
$additionalAttributes
= []
$flags
protected
int
$flags
= self::STRING_CAST_HTML
$linkConfiguration
protected
array<string|int, mixed>
$linkConfiguration
= []
$linkText
protected
string|null
$linkText
= null
$target
protected
string
$target
= ''
$type
protected
string
$type
= \TYPO3\CMS\Core\LinkHandling\LinkService::TYPE_UNKNOWN
$url
protected
string
$url
Methods
__construct()
public
__construct(string $type, string $url) : mixed
Parameters
- $type : string
- $url : string
__toString()
public
__toString() : string
Return values
stringadapt()
Use this method to create a new LinkResult for a specific output format (HTML or JSON)
public
static adapt(LinkResultInterface $other[, int $flags = self::STRING_CAST_HTML ]) : self
Parameters
- $other : LinkResultInterface
- $flags : int = self::STRING_CAST_HTML
Return values
selfgetAttribute()
public
getAttribute(string $attributeName) : string|null
Parameters
- $attributeName : string
Return values
string|nullgetAttributes()
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getHtml()
public
getHtml() : string
Return values
stringgetJson()
public
getJson() : string
Return values
stringgetLinkConfiguration()
public
getLinkConfiguration() : array<string, string>
Return values
array<string, string>getLinkText()
public
getLinkText() : string|null
Return values
string|nullgetTarget()
public
getTarget() : string
Return values
stringgetType()
public
getType() : string
Return values
stringgetUrl()
public
getUrl() : string
Return values
stringhasAttribute()
public
hasAttribute(string $attributeName) : bool
Parameters
- $attributeName : string
Return values
booljsonSerialize()
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>toArray()
public
toArray() : array{href: ?string, target: ?string, class: ?string, title: ?string, linkText: ?string, additionalAttributes: array}
Return values
array{href: ?string, target: ?string, class: ?string, title: ?string, linkText: ?string, additionalAttributes: array}withAttribute()
public
withAttribute(string $attributeName, string|null $attributeValue) : self
Parameters
- $attributeName : string
- $attributeValue : string|null
Return values
selfwithAttributes()
public
withAttributes(array<string|int, mixed> $additionalAttributes[, bool $resetExistingAttributes = false ]) : self
Parameters
- $additionalAttributes : array<string|int, mixed>
- $resetExistingAttributes : bool = false
Return values
selfwithFlags()
public
withFlags(int $flags) : self
Parameters
- $flags : int
Return values
selfwithLinkConfiguration()
public
withLinkConfiguration(array<string|int, mixed> $configuration) : self
Parameters
- $configuration : array<string|int, mixed>
Return values
selfwithLinkText()
public
withLinkText(string $linkText) : self
Parameters
- $linkText : string
Return values
selfwithTarget()
public
withTarget(string $target) : self
Parameters
- $target : string
Return values
selffilterAdditionalAttributes()
protected
filterAdditionalAttributes(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>