|
| | condition ($state) |
| |
| | conditionAll ($state) |
| |
| | addLink ($url, $label="", ?Icon $icon=null, array $attributes=[], $index=null, $before=null) |
| |
| | removeLink ($index) |
| |
| | addButton ($name, $label, ?Icon $icon=null, array $attributes=[]) |
| |
| | addCheckbox ($name, $label, bool $checked, array $attributes=[]) |
| |
| | addRadioButton ($name, $label, bool $checked, array $attributes=[]) |
| |
| | addMultiPersonSearch (MultiPersonSearch $mp) |
| |
| | addSeparator () |
| |
| | addCSSClass ($class) |
| |
| | addAttribute ($key, $value, $append=false) |
| |
| | __toString () |
| |
| | setContext (string $context) |
| |
| | setRenderingMode (?string $mode) |
| |
| | getRenderingMode () |
| |
| | setTitle (string $title) |
| |
| | generateTitle () |
| |
| | setAriaLabel ($label) |
| |
This class represents the action menu used to group actions.
- Author
- Jan-Hendrik Willms tleil.nosp@m.ax+s.nosp@m.tudip.nosp@m.@gma.nosp@m.il.co.nosp@m.m GPL2 or any later version
- Since
- Stud.IP 3.5
◆ __toString()
Magic method to render the menu as a string.
- Returns
- String containing the html representation of the action menu
- See also
- ActionMenu::render()
◆ addAttribute()
| addAttribute |
( |
|
$key, |
|
|
|
$value, |
|
|
|
$append = false |
|
) |
| |
Adds an attribute to the root element in html.
- Parameters
-
| string | $key | Name of the attribute |
| string | $value | Value of the attribute |
| boolean | $append | Whether a current value should be append or not. |
◆ addButton()
| addButton |
( |
|
$name, |
|
|
|
$label, |
|
|
?Icon |
$icon = null, |
|
|
array |
$attributes = [] |
|
) |
| |
Adds a button to the list of actions.
- Parameters
-
| String | $name | Button name |
| String | $label | Textual representation of the name |
| mixed | $icon | Optional icon (as Icon object) |
| array | $attributes | Optional attributes to add to the tag |
- Returns
- static instance to allow chaining
◆ addCheckbox()
| addCheckbox |
( |
|
$name, |
|
|
|
$label, |
|
|
bool |
$checked, |
|
|
array |
$attributes = [] |
|
) |
| |
Adds a checkbox to the list of actions.
- Parameters
-
| String | $name | Input name |
| String | $label | Label displayed in the menu |
| bool | $checked | Checked state of the action |
| array | $attributes | Optional attributes to add to the button |
- Returns
- static instance to allow chaining
◆ addCSSClass()
Adds a css classs to the root element in html.
- Parameters
-
| string | $class | Name of the css class |
- Returns
- static instance to allow chaining
◆ addLink()
| addLink |
( |
|
$url, |
|
|
|
$label = "", |
|
|
?Icon |
$icon = null, |
|
|
array |
$attributes = [], |
|
|
|
$index = null, |
|
|
|
$before = null |
|
) |
| |
Adds a link to the list of actions.
- Parameters
-
| String | StudipLink | $url | Link target, eithe as string or Stud.IP link. In the latter case, all other parameters are ignored. |
| String | array | $label | Textual representation of the link |
| mixed | $icon | Optional icon (as Icon object) |
| array | $attributes | Optional attributes to add to the tag |
| mixed | $index | Optional index to access this link (remove for example) afterwards |
| mixed | $before | Optional index to insert this link before the link with given index. |
- Returns
- static instance to allow chaining
◆ addMultiPersonSearch()
Adds a MultiPersonSearch object to the list of actions.
- Parameters
-
- Returns
- static instance to allow chaining
◆ addRadioButton()
| addRadioButton |
( |
|
$name, |
|
|
|
$label, |
|
|
bool |
$checked, |
|
|
array |
$attributes = [] |
|
) |
| |
Adds a radio button to the list of actions.
- Parameters
-
| String | $name | Input name |
| String | $label | Label displayed in the menu |
| bool | $checked | Checked state of the action |
| array | $attributes | Optional attributes to add to the button |
- Returns
- static instance to allow chaining
◆ addSeparator()
Adds a separator line to the list of actions.
- Returns
- static instance to allow chaining
◆ checkCondition()
Checks the condition. Takes global and local (conditionAll() & condition()) conditions into account.
- Returns
- bool indicating whether the condition is met or not
◆ condition()
Set condition for the next added item. If condition is false, the item will not be added.
- Parameters
-
| bool | $state | State of the condition |
- Returns
- static instance to allow chaining
◆ conditionAll()
Set condition for all the next added items. If condition is false, no items will be added.
- Parameters
-
| bool | $state | State of the condition |
- Returns
- static instance to allow chaining
◆ countActions()
Returns the number of action menu items (not counting separators).
- Returns
- int count
◆ generateTitle()
Generates the title of the action menu, including its context, if the context has been set.
- Returns
- string The title of the action menu.
◆ get()
◆ getKeyForIndex()
◆ getRenderingMode()
Returns the rendering mode for this action menu. This is set by either calling setRenderingMode or automatically determined by the configured threshold.
- Returns
- string
◆ removeLink()
Tries to remove the link with the given index and returns true on success (else false)
- Parameters
-
| $index | : the index of the link. If the link had no special index it's md5($url.json_encode($ttributes)). |
- Returns
- bool : true if link was removed, false if index didn't exist
◆ setAriaLabel()
Sets the label of the menu.
- Parameters
-
| string | $label | label for the menu |
◆ setContext()
| setContext |
( |
string |
$context | ) |
|
Sets the context for the menu.
- Parameters
-
| string | $context | The context to be set. |
- Returns
- static The action menu instance (to allow chaining).
◆ setRenderingMode()
| setRenderingMode |
( |
?string |
$mode | ) |
|
Forces an explicit rendering mode.
- Parameters
-
| string | null | $mode | The desired rendering mode or null for automatic detection |
- Returns
- static The action menu instance to allow chaining
- Exceptions
-
◆ setTitle()
| setTitle |
( |
string |
$title | ) |
|
Sets the title for the action menu.
- Parameters
-
| string | $title | display title |
- Returns
- static instance to allow chaining
◆ $actions
◆ $aria_label
◆ $attributes
◆ $condition
◆ $condition_all
| bool $condition_all = null |
|
protected |
◆ $context
◆ $image
| string $image = '<span></span><span></span><span></span>' |
|
protected |
◆ $image_attributes
| array $image_attributes = [] |
|
protected |
◆ $rendering_mode
| string $rendering_mode = null |
|
protected |
◆ $title
◆ RENDERING_MODE_ICONS
| const RENDERING_MODE_ICONS = 'icons' |
◆ RENDERING_MODE_MENU
| const RENDERING_MODE_MENU = 'menu' |
The documentation for this class was generated from the following file: