Skip to content

Kirby 6.0.0

$field->toLink()

Wraps a link tag around the field value. The field value is used as the link text

$field->toLink(mixed $attr1 = null, mixed $attr2 = null): string

Parameters

Name Type Default Description
$attr1 mixed null Can be an optional URL. If no URL is set, the URL of the parent object will be used. Can also be an array of link attributes
$attr2 mixed null If $attr1 is used to set the URL, you can use $attr2 to pass an array of additional attributes.

Return type

string

Parent class

Kirby\Content\Field