Stud.IP  5.4
Widget Class Reference
Inheritance diagram for Widget:
HelpbarWidget SidebarWidget VueWidget HelpbarTourWidget ClipboardWidget DateSelectWidget ListWidget ResourceTreeWidget RoomSearchWidget SearchWidget SelectWidget TemplateWidget

Public Member Functions

 addElement (WidgetElement $element, $index=null)
 
 insertElement (WidgetElement $element, $before_index, $index=null)
 
 getElement ($index)
 
 getElements ()
 
 removeElement ($index)
 
 hasElements ()
 
 hasElement ($index)
 
 forceRendering ($state=true)
 
 addLayoutCSSClass ($css_class)
 
 removeLayoutCSSClass ($css_class)
 
 render ($variables=[])
 
 __isset ($offset)
 
 __get ($offset)
 
 __set ($offset, $value)
 
 __unset ($offset)
 

Protected Member Functions

 guessIndex (WidgetElement $element)
 

Protected Attributes

 $elements = []
 
 $template = 'widgets/widget'
 
 $template_variables = []
 
 $layout = 'widgets/widget-layout'
 
 $forced_rendering = false
 
 $layout_css_classes = []
 

Detailed Description

Generic Widget

Author
Jan-Hendrik Willms tleil.nosp@m.ax+s.nosp@m.tudip.nosp@m.@gma.nosp@m.il.co.nosp@m.m GPL 2 or later
Since
3.1

Member Function Documentation

◆ __get()

__get (   $offset)

◆ __isset()

__isset (   $offset)

◆ __set()

__set (   $offset,
  $value 
)

◆ __unset()

__unset (   $offset)

◆ addElement()

addElement ( WidgetElement  $element,
  $index = null 
)

Add an element to the widget.

E of WidgetElement

Parameters
E$elementThe actual element
String$indexIndex/name of the element
Returns
E

◆ addLayoutCSSClass()

addLayoutCSSClass (   $css_class)

Adds a css class to the layout

around the widget.

◆ forceRendering()

forceRendering (   $state = true)

Force rendering

Parameters
bool$stateWhether to force rendering or not

◆ getElement()

getElement (   $index)

Retrieve the element at the specified position.

Parameters
String$indexIndex/name of the element to retrieve.
Returns
WidgetElement The element at the specified position.
Exceptions
Exceptionif the specified position is invalid

◆ getElements()

getElements ( )

Returns all elements of the widget.

Returns
array of WidgetElement

◆ guessIndex()

guessIndex ( WidgetElement  $element)
protected

Tries to guess an appropriate index name for the element.

Parameters
WidgetElement$elementThe element in question
Returns
String Appropriate index name

◆ hasElement()

hasElement (   $index)

Returns whether an element exists at the given index.

Parameters
String$indexIndex/name of the element to check for.
Returns
bool Does a widget exist at the given index?

◆ hasElements()

hasElements ( )

Returns whether this widget has any elements.

Returns
bool True if the widget has at least one element, false otherwise.

◆ insertElement()

insertElement ( WidgetElement  $element,
  $before_index,
  $index = null 
)

Insert an element before a specific other element or at the end of the list if the specified position is invalid.

E of WidgetElement

Parameters
E$elementThe actual element
String$before_indexInsert element before this element.
String$indexIndex/name of the element
Returns
E

◆ removeElement()

removeElement (   $index)

Removes the element at the specified position.

Parameters
String$indexIndex/name of the element to remove.
Exceptions
Exceptionif the specified position is invalid

◆ removeLayoutCSSClass()

removeLayoutCSSClass (   $css_class)

Removes a css class from the layout

around the widget.

◆ render()

render (   $variables = [])

Renders the widget. The widget will only be rendered if it contains at least one element.

Returns
String The THML code of the rendered sidebar widget

Field Documentation

◆ $elements

$elements = []
protected

Contains the elements of the widget.

◆ $forced_rendering

$forced_rendering = false
protected

Forced rendering?

◆ $layout

$layout = 'widgets/widget-layout'
protected

Layout for this widget

◆ $layout_css_classes

$layout_css_classes = []
protected

◆ $template

$template = 'widgets/widget'
protected

Contains the template used to render the widget.

◆ $template_variables

$template_variables = []
protected

Contains additional template variables


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