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

$type

protected string $type = \TYPO3\CMS\Core\LinkHandling\LinkService::TYPE_UNKNOWN

Methods

__construct()

public __construct(string $type, string $url) : mixed
Parameters
$type : string
$url : string

__toString()

public __toString() : string
Return values
string

adapt()

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
self

getAttribute()

public getAttribute(string $attributeName) : string|null
Parameters
$attributeName : string
Return values
string|null

getAttributes()

public getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getHtml()

public getHtml() : string
Return values
string

getJson()

public getJson() : string
Return values
string

getLinkConfiguration()

public getLinkConfiguration() : array<string, string>
Return values
array<string, string>

getLinkText()

public getLinkText() : string|null
Return values
string|null

getTarget()

public getTarget() : string
Return values
string

getType()

public getType() : string
Return values
string

getUrl()

public getUrl() : string
Return values
string

hasAttribute()

public hasAttribute(string $attributeName) : bool
Parameters
$attributeName : string
Return values
bool

jsonSerialize()

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
self

withAttributes()

public withAttributes(array<string|int, mixed> $additionalAttributes[, bool $resetExistingAttributes = false ]) : self
Parameters
$additionalAttributes : array<string|int, mixed>
$resetExistingAttributes : bool = false
Return values
self

withFlags()

public withFlags(int $flags) : self
Parameters
$flags : int
Return values
self

withLinkConfiguration()

public withLinkConfiguration(array<string|int, mixed> $configuration) : self
Parameters
$configuration : array<string|int, mixed>
Return values
self

withLinkText()

public withLinkText(string $linkText) : self
Parameters
$linkText : string
Return values
self

withTarget()

public withTarget(string $target) : self
Parameters
$target : string
Return values
self

filterAdditionalAttributes()

protected filterAdditionalAttributes(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results