Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
WidgetContainer Class Reference
Inheritance diagram for WidgetContainer:
Helpbar Sidebar

Public Member Functions

 addWidget (Widget $widget, $index=null)
 
 insertWidget (Widget $widget, $before_index, $index=null)
 
 getWidget ($index)
 
 getWidgets ()
 
 removeWidget ($index)
 
 hasWidgets ()
 
 hasWidget ($index)
 
 render ()
 

Static Public Member Functions

static Get ()
 

Protected Member Functions

 __construct ()
 

Protected Attributes

 $widgets = []
 

Static Protected Attributes

static $instances = null
 

Detailed Description

Generic widget container

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

Constructor & Destructor Documentation

__construct ( )
abstractprotected

Protected constructor to ensure that the singleton Get() method is always used.

See Also
WidgetContainer::Get

Member Function Documentation

addWidget ( Widget  $widget,
  $index = null 
)

Add a widget to the container.

Parameters
Widget$widgetThe actual widget
String$indexOptional index/name of the widget, defaults to class name without "widget"
Returns
Widget The added widget to allow for easier handling
static Get ( )
static

Returns the instance of this container to ensure there is only one instance.

Returns
WidgetContainer The container instance
getWidget (   $index)

Retrieve the widget at the specified position.

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

Returns all widgets of the container.

Returns
array of Widget
hasWidget (   $index)

Returns whether a widget exists at the given index.

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

Returns whether this container has any widget.

Returns
bool True if the container has at least one widget, false otherwise.
insertWidget ( Widget  $widget,
  $before_index,
  $index = null 
)

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

Parameters
Widget$widgetThe actual widget
String$before_indexInsert widget before this widget
String$indexOptional index/name of the widget, defaults to class name without "widget"
Returns
Widget The inserted widget to allow for easier handling
removeWidget (   $index)

Removes the widget at the specified position.

Parameters
String$indexIndex/name of the widget to remove.
Exceptions
Exceptionif the specified position is invalid
render ( )
abstract

Renders the container.

Field Documentation

$instances = null
staticprotected

The singleton instance of the container

$widgets = []
protected

Contains the widgets of the container


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