Stud.IP  5.4
Interactable Class Reference
Inheritance diagram for Interactable:
Button LinkButton ResetButton

Public Member Functions

 __construct ($label, $attributes)
 

Static Public Member Functions

static __callStatic ($name, $args)
 
static create ($label=NULL, $trait=NULL, $attributes=[])
 
static createAccept ($label=NULL, $trait=NULL, $attributes=[])
 
static createEdit ($label=NULL, $trait=NULL, $attributes=[])
 
static createCancel ($label=NULL, $trait=NULL, $attributes=[])
 

Data Fields

 $label
 
 $attributes
 

Protected Member Functions

 initialize ($label, $trait, $attributes)
 

Detailed Description

Represents an abstract interactable element.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $label,
  $attributes 
)
final

Constructs a new element to interact e.g. button or link

Parameters
string$labelthe label of the button
array$attributesthe attributes of the button element

Member Function Documentation

◆ __callStatic()

static __callStatic (   $name,
  $args 
)
static

Magic method (triggered when invoking inaccessible methods in a static context) used to dynamically create an interactable element with an additional CSSclass. This works for every static method call matching: /^create(.+)/ The matched group is used as CSS class for the interactable element.

echo Button::createSubmit();
# => <button ... class="submit">...
Parameters
string$namename of the method being called
array$argsenumerated array containing the parameters passed to the $name'ed method
Returns
Interactable returns a Button, if $name =~ /^create/
Exceptions
throwsa BadMethodCallException if $name does not match

◆ create()

static create (   $label = NULL,
  $trait = NULL,
  $attributes = [] 
)
static

Easy factory method to create an Interactable instance. All parameters are optional.

// example using subclass Button
# => <button type="submit" name="ok">ok</button>
echo Button::create('Yes')
# => <button type="submit" name="yes">yes</button>
echo Button::create('Yes', 'aName')
# => <button type="submit" name="aName">yes</button>
echo Button::create('Yes', array('a' => 1, 'b' => 2))
# => <button type="submit" a="1" b="2" name="yes">yes</button>
echo Button::create('Yes', 'aName', array('a' => 1, 'b' => 2)),
# => <button type="submit" a="1" b="2" name="aName">yes</button>
Parameters
string$labelthe label of the current element
string$traitthe specific trait of the current element
array$attributesthe attributes of the button element
Returns
Interactable element

◆ createAccept()

static createAccept (   $label = NULL,
  $trait = NULL,
  $attributes = [] 
)
static

Convenience method used for autocompletion hints by your editor.

Without this method __callStatic would do the same.

Parameters
string$labelthe label of the current element
string$traitthe specific trait of the current element
array$attributesthe attributes of the button element

◆ createCancel()

static createCancel (   $label = NULL,
  $trait = NULL,
  $attributes = [] 
)
static

Convenience method used for autocompletion hints by your editor.

Without this method __callStatic would do the same.

Parameters
string$labelthe label of the current element
string$traitthe specific trait of the current element
array$attributesthe attributes of the button element

◆ createEdit()

static createEdit (   $label = NULL,
  $trait = NULL,
  $attributes = [] 
)
static

Convenience method used for autocompletion hints by your editor.

Without this method __callStatic would do the same.

Parameters
string$labelthe label of the current element
string$traitthe specific trait of the current element
array$attributesthe attributes of the button element

◆ initialize()

initialize (   $label,
  $trait,
  $attributes 
)
abstractprotected

Initialize an interactable element. The parameters to create are handed over to enable subclass specific customization.

Parameters
string$labelthe label of the current element
string$traitthe specific trait of the current element
array$attributesthe attributes of the button element

Field Documentation

◆ $attributes

$attributes

◆ $label

$label

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