LinkAddition
in package
implements
AdditionInterface
FinalYes
Link addition for making text ranges tappable.
Used within text components to create hyperlinks on specific ranges of text.
Tags
Table of Contents
Interfaces
- AdditionInterface
- Interface for all addition types.
Properties
- $rangeLength : int|null
- The length of the link range.
- $rangeStart : int|null
- The start position of the link range.
- $url : string
Methods
- __construct() : mixed
- Create a new LinkAddition.
- forRange() : self
- Create a link for a specific text range.
- getType() : string
- Get the addition type identifier.
- jsonSerialize() : array<string, mixed>
- {@inheritdoc}
- setRange() : $this
- Set the text range for this link.
- to() : self
- Create a link addition with a URL.
Properties
$rangeLength
The length of the link range.
private
int|null
$rangeLength
= null
$rangeStart
The start position of the link range.
private
int|null
$rangeStart
= null
$url read-only
private
string
$url
Methods
__construct()
Create a new LinkAddition.
public
__construct(string $url) : mixed
Parameters
- $url : string
-
The link URL.
forRange()
Create a link for a specific text range.
public
static forRange(string $url, int $start, int $length) : self
Parameters
- $url : string
-
The URL to link to.
- $start : int
-
The starting character position.
- $length : int
-
The number of characters.
Return values
self —A new instance.
getType()
Get the addition type identifier.
public
getType() : string
Return values
string —The addition type.
jsonSerialize()
{@inheritdoc}
public
jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>setRange()
Set the text range for this link.
public
setRange(int $start, int $length) : $this
Parameters
- $start : int
-
The starting character position.
- $length : int
-
The number of characters.
Return values
$thisto()
Create a link addition with a URL.
public
static to(string $url) : self
Parameters
- $url : string
-
The URL to link to.
Return values
self —A new instance.