Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
LinkElement Class Reference
Inheritance diagram for LinkElement:
WidgetElement

Public Member Functions

 __construct ($label, $url,\Icon $icon=null, $attributes=[])
 
 setActive ($active=true)
 
 asDialog ($state= '')
 
 asButton ($state=true)
 
 setTarget ($target)
 
 addClass ($class)
 
 setDisabled ($state=true)
 
 isDisabled ()
 
 render ()
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
- Public Member Functions inherited from WidgetElement
 __construct ($content= '')
 
 render ()
 

Static Public Member Functions

static fromHTML ($html,\Icon $icon=null)
 

Data Fields

 $url
 
 $label
 
 $icon
 
 $active = false
 
 $attributes = []
 
 $as_button = false
 

Protected Member Functions

 renderButton ()
 
 isURL ($url)
 

Static Protected Member Functions

static parseAttributes ($text)
 

Additional Inherited Members

- Protected Attributes inherited from WidgetElement
 $content
 

Detailed Description

Author
Jan-Hendrik Willms tleil.nosp@m.ax+s.nosp@m.tudip.nosp@m.@gma.nosp@m.il.co.nosp@m.m GPL2 or any later version

Constructor & Destructor Documentation

__construct (   $label,
  $url,
\Icon  $icon = null,
  $attributes = [] 
)

create a link for a widget

Parameters
String$labelLabel/content of the link
String$urlURL/Location of the link (raw url, no entities)
Icon$iconIcon for the link
array$attributesHTML-attributes for the a-tag in an associative array.

Member Function Documentation

addClass (   $class)

Adds a css class to the rendered element.

Parameters
string$clasCSS class to add
Returns
LinkElement instance to allow chaining
asButton (   $state = true)

Defines whether the link should be rendered as a button/form with POST method.

Parameters
bool$activeState (optional, defaults to true)
Returns
LinkElement instance to allow chaining
asDialog (   $state = '')

Sets the dialog options for the element. Passing false as $state will reset the dialog options to "none".

Parameters
mixed$activeDialog options (optional, defaults to blank/standard dialog)
Returns
LinkElement instance to allow chaining
static fromHTML (   $html,
\Icon  $icon = null 
)
static

Create link by parsing a html chunk.

Parameters
String$htmlHTML chunk to parse
Icon$iconOptional icon
Returns
LinkElement Link element from parsed html
Exceptions
Exceptionif html can not be parsed
isDisabled ( )

Returns whether the element is disabled.

Returns
bool
isURL (   $url)
protected

Returns whether the given url is valid.

Parameters
string$urlURL to test
Returns
bool
offsetExists (   $offset)
offsetGet (   $offset)
offsetSet (   $offset,
  $value 
)
offsetUnset (   $offset)
static parseAttributes (   $text)
staticprotected

Parse a string of html attributes into an associative array.

Parameters
String$textString of html attributes
Returns
Array parsed attributes as key => value pairs
See Also
https://gist.github.com/rodneyrehm/3070128
render ( )

Renders the element.

Returns
string
renderButton ( )
protected

Renders the element as a button/form.

Returns
string
setActive (   $active = true)

Sets the active state of the element.

Parameters
bool$activeActive state (optional, defaults to true)
Returns
LinkElement instance to allow chaining
setDisabled (   $state = true)

Set disabled state

Parameters
boolean$stateDisabled state
Returns
LinkElement instance to allow chaining
setTarget (   $target)

Sets the target attribute of the element.

Parameters
string$targetTarget attribute
Returns
LinkElement instance to allow chaining

Field Documentation

$active = false
$as_button = false
$attributes = []
$icon
$url

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