Skip to content

LinkData ​

Type
Class
Namespace
craft\fields\data
Inherits
craft\fields\data\LinkData » yii\base\BaseObject
Implements
craft\base\Serializable, yii\base\Configurable
Since
5.3.0

Link field data class.

View source

Public Properties ​

PropertyDescription
elementcraft\base\ElementInterface, null – The element linked by the field, if there is one
labelstring – The link label
link\Twig\Markup, null – An anchor tag for this link
typestring – The link type ID
valuestring – The link value

element ​

Type
craft\base\ElementInterface, null
Default value
null

The element linked by the field, if there is one

View source

label ​

Type
string
Default value
null

The link label

View source

Type
\Twig\Markup, null
Default value
null

An anchor tag for this link

View source

type ​

Type
string
Default value
null

The link type ID

View source

value ​

Type
string
Default value
null

The link value

View source

Public Methods ​

MethodDescription
__call()Calls the named method which is not a class method.
__construct()
__get()Returns the value of an object property.
__isset()Checks if a property is set, i.e. defined and not null.
__set()Sets value of an object property.
__toString()
__unset()Sets an object property to null.
canGetProperty()Returns a value indicating whether a property can be read.
canSetProperty()Returns a value indicating whether a property can be set.
className()Returns the fully qualified name of this class.
getElement()Returns the element linked by the field, if there is one.
getLabel()Returns the link label.
getLink()Returns an anchor tag for this link.
getType()Returns the link type ID.
getValue()Returns the link value.
hasMethod()Returns a value indicating whether a method is defined.
hasProperty()Returns a value indicating whether a property is defined.
init()Initializes the object.
serialize()

__construct() ​

View source

Arguments ​

  • $value
  • $linkType
  • $config

__toString() ​

View source

getElement() ​

Returns the element linked by the field, if there is one.

View source

Returns ​

craft\base\ElementInterface, null

getLabel() ​

Returns the link label.

View source

Returns ​

string

Returns an anchor tag for this link.

View source

Returns ​

\Twig\Markup, null

getType() ​

Returns the link type ID.

View source

Returns ​

string

getValue() ​

Returns the link value.

View source

serialize() ​

View source