Stud.IP  5.4
Link Class Reference
Inheritance diagram for Link:
Part

Public Member Functions

 __construct (string $url, string $label, \Icon $icon=null)
 
 setURL (string $url)
 
 getURL ()
 
 setLabel (string $label)
 
 getLabel ()
 
 setIcon (\Icon $icon=null)
 
 getIcon ()
 
 setAttributes (array $attributes)
 
 addAttributes (array $attributes)
 
 setAttribute (string $key, $value)
 
 getAttributes ()
 
 removeAttribute (string $key, bool $throw_exception=false)
 
 render ()
 
- Public Member Functions inherited from Part
 __construct (... $parts)
 
 setContextObject ($object)
 
 getContextObject ()
 
 addPart (Part $part)
 
 addInput (Input $input)
 
 addText (string $text, bool $text_is_html=true)
 
 addLink (string $title, string $url, ?\Icon $icon=null, array $attributes=[])
 
 render ()
 
 renderWithCondition ()
 
 getAllInputs ()
 
 setParent (Part $parent)
 
 setIfCondition ($if)
 
 getInputFromArray (array $data)
 

Protected Attributes

 $url
 
 $label
 
 $icon
 
 $attributes = []
 
- Protected Attributes inherited from Part
 $parent = null
 
 $contextobject = null
 
 $parts = []
 

Additional Inherited Members

- Data Fields inherited from Part
 $if = null
 

Detailed Description

The Link class represents a part of a form that displays a link.

Constructor & Destructor Documentation

◆ __construct()

__construct ( string  $url,
string  $label,
\Icon  $icon = null 
)

Member Function Documentation

◆ addAttributes()

addAttributes ( array  $attributes)

Adds/appends attributes to the current attributes for the link.

Parameters
array$attributes
Returns
$this

◆ getAttributes()

getAttributes ( )

Returns the attributes for the link.

Returns
array

◆ getIcon()

getIcon ( )

Returns the icon for the link.

Returns
|null

◆ getLabel()

getLabel ( )

Returns the label for the link.

Returns
string

◆ getURL()

getURL ( )

Returns the url for the link.

Returns
string

◆ removeAttribute()

removeAttribute ( string  $key,
bool  $throw_exception = false 
)

Removes an attribute.

Parameters
string$key
bool$throw_exceptionThrow an exception if the attribute does not exists (default: false)
Returns
$this

◆ render()

render ( )

"Renders" the text: Either return it directly, if it is HTML or call htmlReady first before returning it.

Returns
string The text that shall be placed in the form, either as HTML or plain text.

◆ setAttribute()

setAttribute ( string  $key,
  $value 
)

Sets a single attribute for the link.

Parameters
string$key
mixed$value
Returns
$this

◆ setAttributes()

setAttributes ( array  $attributes)

Replaces all attributes for the link.

Parameters
array$attributes
Returns
$this

◆ setIcon()

setIcon ( \Icon  $icon = null)

Sets the icon for the link. May be null to remove the icon.

Parameters
\Icon$icon
Returns
$this

◆ setLabel()

setLabel ( string  $label)

Sets the label for the link.

Parameters
string$label
Returns
$this

◆ setURL()

setURL ( string  $url)

Sets the url for the link.

Parameters
string$url
Returns
$this

Field Documentation

◆ $attributes

$attributes = []
protected

◆ $icon

$icon
protected

◆ $label

$label
protected

◆ $url

$url
protected

The documentation for this class was generated from the following file: