Stud.IP  5.4
Part Class Reference
Inheritance diagram for Part:
Fieldset Form InputRow Link Text

Public Member Functions

 __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)
 

Data Fields

 $if = null
 

Protected Attributes

 $parent = null
 
 $contextobject = null
 
 $parts = []
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $parts)

Constructor of this Part. Can take one or more Part objects or Input objects or arrays representing an Input object.

Parameters
...$parts

Member Function Documentation

◆ addInput()

addInput ( Input  $input)

Adds an Input to this Part.

Parameters
Input$input
Returns
Input

◆ addLink()

addLink ( string  $title,
string  $url,
?\Icon  $icon = null,
array  $attributes = [] 
)

Adds a link as a form part.

Parameters
string$titleThe title of the link.
string$urlThe URL of the link.
\Icon | null$iconThe icon to be used for the link.
array$attributesAdditional link attributes.
Returns
Link The Text form element containing the link as HTML.

◆ addPart()

addPart ( Part  $part)

Adds a Part object on the next layer.

Parameters
Part$part
Returns
$this

◆ addText()

addText ( string  $text,
bool  $text_is_html = true 
)

Adds a text block inside the form.

Parameters
string$textThe text to be added.
bool$text_is_htmlWhether the text is HTML (true) or plain text (false). Defaults to true.
Returns
Text The added text form part.

◆ getAllInputs()

getAllInputs ( )

Recursively returns all Input elements attached to this Part object or any child Parts.

Returns
array

◆ getContextObject()

getContextObject ( )

Returns the context object of this Part if there is any. If there is none it tries to return the context-object of a parent object.

Returns
void|null

◆ getInputFromArray()

getInputFromArray ( array  $data)

Returns an Input element from an array.

Parameters
array$data
Returns
array|mixed
Exceptions

◆ render()

render ( )

Renders this Part object. This could be a section or any other HTML element with child-elements.

Returns
string

◆ renderWithCondition()

renderWithCondition ( )

Renders the Part element with a condition.

Returns
string

◆ setContextObject()

setContextObject (   $object)

Sets the context-object which is most likely a SimpleORMap object

Parameters
$object
Returns
$this

◆ setIfCondition()

setIfCondition (   $if)

Sets a condition to display this Part. The condition is a javascript condition which is used by vue to hide the input if the condition is not satisfies.

Parameters
string$if
Returns
$this

◆ setParent()

setParent ( Part  $parent)

Sets the parent object of this Part. Usually this is done automatically.

Parameters
Part$parent
Returns
$this
Exceptions

Field Documentation

◆ $contextobject

$contextobject = null
protected

◆ $if

$if = null

◆ $parent

$parent = null
protected

◆ $parts

$parts = []
protected

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