DropDownButton

class \TYPO3\CMS\Backend\Template\Components\Buttons\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.

Example:

$buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
$dropDownButton = $buttonBar->makeDropDownButton()
     ->setLabel('Dropdown')
     ->setTitle('Save')
     ->setIcon($this->iconFactory->getIcon('actions-heart'))
     ->setShowLabelText(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

$disabled  : bool
$icon  : Icon|null
$items  : array
$label  : string
$showLabelText  : bool
$title  : string|null

Methods

__toString()  : string
addItem()  : self
getIcon()  : Icon|null
getItems()  : DropDownItemInterface[]
getLabel()  : string
getShowLabelText()  : bool
getTitle()  : string
getType()  : string
Returns the fully qualified class name of the button as a string
isDisabled()  : bool
isValid()  : bool
Validates all set parameters of a button.
render()  : string
Renders the markup for the button
setDisabled()  : self
setIcon()  : self
setLabel()  : self
setShowLabelText()  : self
setTitle()  : self

Properties

$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

isDisabled()

public isDisabled() : bool

Return values

bool

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

setDisabled()

public setDisabled(bool $disabled) : self

Parameters

$disabled : bool

Return values

self

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