Stud.IP  4.2 Revision
WidgetAction Class Reference
Collaboration diagram for WidgetAction:
Collaboration graph

Public Member Functions

 __construct ($label, callable $callback=null, array $attributes=[])
 
 setLabel ($label)
 
 getLabel ()
 
 setCallback (callable $callback)
 
 getCallback ()
 
 invokeCallback (array $arguments)
 
 setAttributes (array $attributes)
 
 getAttributes ()
 
 hasIcon ($has_icon=null)
 
 setAdminMode ($state=true)
 
 getAdminMode ()
 
 setIcon (Icon $icon)
 
 getIcon ()
 

Protected Attributes

 $label
 
 $callback
 
 $attributes
 
 $has_icon = true
 
 $admin_mode = false
 

Detailed Description

This class represent an action that is associated with a certain widget.

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
Since
Stud.IP 4.1

Constructor & Destructor Documentation

◆ __construct()

__construct (   $label,
callable  $callback = null,
array  $attributes = [] 
)

Constructs the action.

Parameters
string$labelLabel/name of the action
callable$callbackCallback to execute when the action is executed
array$attributesOptional additional attributes for the rendered action element

Member Function Documentation

◆ getAdminMode()

getAdminMode ( )

Returns whether this action requires admin mode.

Returns
bool

◆ getAttributes()

getAttributes ( )

Returns the defined attributes of this action.

Returns
array

◆ getCallback()

getCallback ( )

Returns the defined callback of this action.

Returns
WidgetAction or null

◆ getIcon()

getIcon ( )

Returns the defined action for this action.

Returns
Icon instance or null if no icon has been defined.

◆ getLabel()

getLabel ( )

Returns the label/name of this action.

Returns
string

◆ hasIcon()

hasIcon (   $has_icon = null)

Returns whether an icon has been defined if no parameters is passed or sets whether an icon is defined if a parameter is passed.

Parameters
mixed$has_iconOptional state to set
Returns
mixed Current state if no parameter is set
Todo:
This seems rather nasty.
Here is the caller graph for this function:

◆ invokeCallback()

invokeCallback ( array  $arguments)

Invokes the defined callback for this action.

Parameters
array$argumentsAdditional arguments to pass to the callback
Returns
mixed whatever the callback might return or null if no callback was defined

◆ setAdminMode()

setAdminMode (   $state = true)

Defines whether this action requires admin mode.

Parameters
bool$state

◆ setAttributes()

setAttributes ( array  $attributes)

Sets the attributes for the rendered html element.

Parameters
array$attributesSet of attributes
Returns
WidgetAction instance to allow chaining
Here is the caller graph for this function:

◆ setCallback()

setCallback ( callable  $callback)

Sets the callback to execute to execute when this action is executed.

Parameters
callbacke$callbackCallback to execute when this action is executed
Returns
WidgetAction instance to allow chaining

◆ setIcon()

setIcon ( Icon  $icon)

Defines an icon for the action.

Parameters
Icon$iconIcon for the action

◆ setLabel()

setLabel (   $label)

Sets the label/name for this action.

Parameters
string$labelLabel/name of the action
Returns
WidgetAction instance to allow chaining

Field Documentation

◆ $admin_mode

$admin_mode = false
protected

◆ $attributes

$attributes
protected

◆ $callback

$callback
protected

◆ $has_icon

$has_icon = true
protected

◆ $label

$label
protected

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