DropDownButton implements ButtonInterface
DropDownButton
This button type is a container for dropdown items. It will render a dropdown containing all items attached to it. There are different kinds available, each item needs to implement the DropDownItemInterface. When this type contains elements of type DropDownRadio it will use the icon of the first active item of this type.
$buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar(); $dropDownButton = $buttonBar->makeDropDownButton() ->setLabel('Dropdown') ->setTitle('Save') ->setIcon($this->iconFactory->getIcon('actions-heart')) ->getShowLabelText(true) ->addItem( GeneralUtility::makeInstance(DropDownItem::class) ->setLabel('Item') ->setHref('#') ); $buttonBar->addButton($dropDownButton, ButtonBar::BUTTON_POSITION_RIGHT, 2);
Table of Contents
Interfaces
- ButtonInterface
- Interface for buttons
Properties
- $icon : Icon|null
- $items : array<string|int, mixed>
- $label : string
- $showLabelText : bool
- $title : string|null
Methods
- __toString() : string
- addItem() : self
- getIcon() : Icon|null
- getItems() : array<string|int, DropDownItemInterface>
- getLabel() : string
- getShowLabelText() : bool
- getTitle() : string
- getType() : string
- Returns the fully qualified class name of the button as a string
- isValid() : bool
- Validates all set parameters of a button.
- render() : string
- Renders the markup for the button
- setIcon() : self
- setLabel() : self
- setShowLabelText() : self
- setTitle() : self
Properties
$icon
protected
Icon|null
$icon
= null
$items
protected
array<string|int, mixed>
$items
= []
$label
protected
string
$label
= ''
$showLabelText
protected
bool
$showLabelText
= false
$title
protected
string|null
$title
= null
Methods
__toString()
public
__toString() : string
Return values
stringaddItem()
public
addItem(DropDownItemInterface $item) : self
Parameters
- $item : DropDownItemInterface
Return values
selfgetIcon()
public
getIcon() : Icon|null
Return values
Icon|nullgetItems()
public
getItems() : array<string|int, DropDownItemInterface>
Return values
array<string|int, DropDownItemInterface>getLabel()
public
getLabel() : string
Return values
stringgetShowLabelText()
public
getShowLabelText() : bool
Return values
boolgetTitle()
public
getTitle() : string
Return values
stringgetType()
Returns the fully qualified class name of the button as a string
public
getType() : string
Return values
stringisValid()
Validates all set parameters of a button.
public
isValid() : bool
Return values
boolrender()
Renders the markup for the button
public
render() : string
Return values
stringsetIcon()
public
setIcon(Icon|null $icon) : self
Parameters
- $icon : Icon|null
Return values
selfsetLabel()
public
setLabel(string $label) : self
Parameters
- $label : string
Return values
selfsetShowLabelText()
public
setShowLabelText(bool $showLabelText) : self
Parameters
- $showLabelText : bool
Return values
selfsetTitle()
public
setTitle(string|null $title) : self
Parameters
- $title : string|null