Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
ContentGroupMenu Class Reference

Public Member Functions

 condition ($state)
 
 conditionAll ($state)
 
 addLink ($link, $label, Icon $icon=null, array $attributes=[])
 
 addButton ($name, $label, Icon $icon=null, array $attributes=[])
 
 addMultiPersonSearch (MultiPersonSearch $mp)
 
 addCSSClass ($class)
 
 addAttribute ($key, $value, $append=false)
 
 render ()
 
 setIcon ($menu_image, array $image_link_attributes=[])
 
 setLabel ($label)
 
 setAriaLabel ($label)
 
 countLinks ()
 

Static Public Member Functions

static get ()
 

Data Fields

const THRESHOLD = 1
 

Protected Member Functions

 checkCondition ()
 

Detailed Description

This class represents the a more flexible menu used to group actions.

Author
Timo Hartge hartg.nosp@m.e@da.nosp@m.ta-qu.nosp@m.est..nosp@m.de GPL2 or any later version
Since
Stud.IP 4.0

Member Function Documentation

addAttribute (   $key,
  $value,
  $append = false 
)

Adds an attribute to the root element in html.

Parameters
string$keyName of the attribute
string$valueValue of the attribute
boolean$appendWhether a current value should be append or not.
addButton (   $name,
  $label,
Icon  $icon = null,
array  $attributes = [] 
)

Adds a button to the list of actions.

Parameters
String$nameButton name
String$labelTextual representation of the name
mixed$iconOptional icon (as Icon object)
array$attributesOptional attributes to add to the tag
Returns
ContentGroupMenu instance to allow chaining
addCSSClass (   $class)

Adds a css classs to the root element in html.

Parameters
string$className of the css class
addLink (   $link,
  $label,
Icon  $icon = null,
array  $attributes = [] 
)

Adds a link to the list of actions.

Parameters
String$linkLink target
String$labelTextual representation of the link
mixed$iconOptional icon (as Icon object)
array$attributesOptional attributes to add to the tag
Returns
ContentGroupMenu instance to allow chaining
addMultiPersonSearch ( MultiPersonSearch  $mp)

Adds a MultiPersonSearch object to the list of actions.

Parameters
MultiPersonSearch$mpMultiPersonSearch object
Returns
ContentGroupMenu instance to allow chaining
checkCondition ( )
protected

Checks the condition. Takes global and local (conditionAll() & condition()) conditions into account.

Returns
bool indicating whether the condition is met or not
condition (   $state)

Set condition for the next added item. If condition is false, the item will not be added.

Parameters
bool$stateState of the condition
Returns
ContentGroupMenu instance to allow chaining
conditionAll (   $state)

Set condition for all the next added items. If condition is false, no items will be added.

Parameters
bool$stateState of the condition
Returns
ContentGroupMenu instance to allow chaining
countLinks ( )

Return the number of menu actions.

Returns
integer count actions
static get ( )
static

Returns an instance.

Returns
ContentGroupMenu
render ( )

Renders the action menu. If no item was added, an empty string will be returned. If a single item was added, the item itself will be displayed. Otherwise the whole menu will be rendered.

Returns
String containing the html representation of the action menu
setAriaLabel (   $label)

Sets the label of the menu.

Parameters
String$labellabel for the menu
setIcon (   $menu_image,
array  $image_link_attributes = [] 
)

Sets the icon of the menu.

Parameters
String$menu_imageimage html for the menu
array$image_link_attributesAdditional HTML attributes for the link that surrounds the image.
setLabel (   $label)

Sets the label of the menu.

Parameters
String$labellabel for the menu

Field Documentation

const THRESHOLD = 1

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