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

$items

protected array<string|int, mixed> $items = []

$showLabelText

protected bool $showLabelText = false

Methods

__toString()

public __toString() : string
Return values
string

getLabel()

public getLabel() : string
Return values
string

getShowLabelText()

public getShowLabelText() : bool
Return values
bool

getTitle()

public getTitle() : string
Return values
string

getType()

Returns the fully qualified class name of the button as a string

public getType() : string
Return values
string

isValid()

Validates all set parameters of a button.

public isValid() : bool
Return values
bool

render()

Renders the markup for the button

public render() : string
Return values
string

setIcon()

public setIcon(Icon|null $icon) : self
Parameters
$icon : Icon|null
Return values
self

setLabel()

public setLabel(string $label) : self
Parameters
$label : string
Return values
self

setShowLabelText()

public setShowLabelText(bool $showLabelText) : self
Parameters
$showLabelText : bool
Return values
self

setTitle()

public setTitle(string|null $title) : self
Parameters
$title : string|null
Return values
self

        
On this page

Search results