GenericButton

class \TYPO3\CMS\Backend\Template\Components\Buttons\GenericButton

Implements
ButtonInterface

GenericButton

Example:

$button = GeneralUtility::makeInstance(GenericButton::class)
    ->setTag('a')
    ->setHref('#')
    ->setLabel('Label')
    ->setTitle('Title')
    ->setIcon($this->iconFactory->getIcon('actions-heart'))
    ->setAttributes(['data-value' => '123']);

Table of Contents

Interfaces

ButtonInterface
Interface for buttons

Properties

$attributes  : array
$classes  : string
$href  : string|null
$icon  : Icon|null
$label  : string
$showLabelText  : bool
$tag  : string
$title  : string|null

Methods

__toString()  : string
getAttributes()  : array<string, string>
getClasses()  : string
getHref()  : string|null
getIcon()  : Icon|null
getLabel()  : string|null
getShowLabelText()  : bool
getTag()  : string
getTitle()  : string|null
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
setAttributes()  : self
setClasses()  : self
setHref()  : self
setIcon()  : self
setLabel()  : self
setShowLabelText()  : self
setTag()  : self
setTitle()  : self
getAttributesString()  : string

Properties

$attributes

protected array $attributes = []

$showLabelText

protected bool $showLabelText = false

Methods

__toString()

public __toString() : string

Return values

string

getAttributes()

public getAttributes() : array<string, string>

Return values

array<string, string>

getClasses()

public getClasses() : string

Return values

string

getHref()

public getHref() : string|null

Return values

string|null

getLabel()

public getLabel() : string|null

Return values

string|null

getShowLabelText()

public getShowLabelText() : bool

Return values

bool

getTag()

public getTag() : string

Return values

string

getTitle()

public getTitle() : string|null

Return values

string|null

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

setAttributes()

public setAttributes(array<string, string> $attributes) : self

Parameters

$attributes : array<string, string>

Return values

self

setClasses()

public setClasses(string $classes) : self

Parameters

$classes : string

Return values

self

setHref()

public setHref(string|null $href) : self

Parameters

$href : string|null

Return values

self

setIcon()

public setIcon(Icon|null $icon) : self

Parameters

$icon : Icon|null

Return values

self

setLabel()

public setLabel(string|null $label) : self

Parameters

$label : string|null

Return values

self

setShowLabelText()

public setShowLabelText(bool $showLabelText) : self

Parameters

$showLabelText : bool

Return values

self

setTag()

public setTag(string $tag) : self

Parameters

$tag : string

Return values

self

setTitle()

public setTitle(string|null $title) : self

Parameters

$title : string|null

Return values

self

getAttributesString()

protected getAttributesString() : string

Return values

string
On this page