\phpDocumentor\Transformer\Writer\Twig\LinkRendererTarget

The target of a link and how it should be presented.

Links in phpDocumentor can be based on any number of types of input, ranging from FQCNs, Descriptors, absolute urls to things like references.

To simplify the rendering of these links, we first analyze and transform the input into this Target object. Once the object is formed, it is passed onto the {@see \phpDocumentor\Transformer\Writer\Twig\LinkRenderer\LinkAdapter} to transform it into an actual HTML link that can be shown.

Summary

Methods
Properties
Constants
__construct()
getTitle()
getAbbreviation()
getUrl()
getPresentation()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
setPresentation()
$title
$abbreviation
$url
$presentation
N/A

Properties

$title

$title : string

The title of the target that needs to be shown in the link text, or when an abbreviation is present as part of the ABBR tag's title attribute.

Type

string

$abbreviation

$abbreviation : ?string

Targets can optionally have their link text be an abbreviation.

When this field is not null, it is used as the link text and the regular title is set as the title attribute of a generated ABBR tag.

Type

?string

$url

$url : ?string

The link url of this Target.

The {@see \phpDocumentor\Transformer\Writer\Twig\LinkRenderer} is responsible for converting an 'input' to something that can be linked to; and the URL represents the thing that should be linked to.

Sometimes, input cannot be resolved (FQCNs that we do not document). When that happens the URL is null, and the {@see \phpDocumentor\Transformer\Writer\Twig\LinkRenderer\HtmlFormatter} will still render a reference to that FQCN, but without a link.

Type

?string

$presentation

$presentation : string

How should the HTML be formatted.

The {@see \phpDocumentor\Transformer\Writer\Twig\LinkRenderer\HtmlFormatter} is responsible for transforming this target into HTML; but the presentation of a link can vary depending on where it is used. When used in twig templates, the caller can indicate how an element should be rendered according to this presentation.

Type

string

Methods

__construct()

__construct(string  $title, ?string  $url = null, string  $presentation = LinkRenderer::PRESENTATION_NORMAL) : mixed

Parameters

string $title
?string $url
string $presentation

Returns

mixed —

getTitle()

getTitle() : string

Returns

string —

getAbbreviation()

getAbbreviation() : ?string

Returns

?string —

getUrl()

getUrl() : ?string

Returns

?string —

getPresentation()

getPresentation() : string

Returns

string —

setPresentation()

setPresentation(string  $presentation) : void

Parameters

string $presentation