InputButton extends AbstractButton
InputButton
This button type renders a HTML tag
Since we no longer want to have any in the TYPO3 core you should use this button type to send forms
EXAMPLE USAGE TO ADD A BUTTON TO THE FIRST BUTTON GROUP IN THE LEFT BAR:
$buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar(); $saveButton = $buttonBar->makeInputButton() ->setName('save') ->setValue('1') ->setIcon($this->iconFactory->getIcon('actions-document-save', Icon::SIZE_SMALL)) ->setTitle('Save'); $buttonBar->addButton($saveButton, ButtonBar::BUTTON_POSITION_LEFT, 1);
Table of Contents
Properties
- $classes : string
- HTML tag attribute for class
- $dataAttributes : array<string|int, mixed>
- HTML tag attributes for data-* Use key => value pairs
- $disabled : bool
- Disabled state of the button
- $form : string
- ID of the referenced <form> tag
- $icon : Icon
- Icon object
- $name : string
- Name Attribute of the button
- $onClick : string
- HTML tag attribute onClick Outdated, use sparingly
- $showLabelText : bool
- Defines whether to show the title as a label within the button
- $title : string
- HTML tag attribute for title
- $value : string
- Value attribute of the button
Methods
- __toString() : string
- Magic method so Fluid can access a button via {button}
- getClasses() : string
- Get classes
- getDataAttributes() : array<string|int, mixed>
- Get Data attributes
- getForm() : string
- getIcon() : Icon
- Get icon
- getName() : string
- Get name
- getOnClick() : string
- Get Onclick Attribute
- getShowLabelText() : bool
- Show Label text
- getTitle() : string
- Get Title
- getType() : string
- Get type
- getValue() : string
- Get value
- hasOnClick() : bool
- Helper method to avoid using `getOnClick` in TYPO3 core.
- isDisabled() : bool
- Check if button is disabled
- isValid() : bool
- Validates the current button
- render() : string
- Renders the markup of the button
- setClasses() : $this
- Set classes
- setDataAttributes() : $this
- Set Data attributes
- setDisabled() : AbstractButton
- Set if button needs to be disabled
- setForm() : InputButton
- setIcon() : $this
- Set icon
- setName() : InputButton
- Set name
- setOnClick() : $this
- Set OnClick
- setShowLabelText() : $this
- Show Label text
- setTitle() : $this
- Set title attribute
- setValue() : InputButton
- Set value
Properties
$classes
HTML tag attribute for class
protected
string
$classes
= ''
$dataAttributes
HTML tag attributes for data-* Use key => value pairs
protected
array<string|int, mixed>
$dataAttributes
= []
$disabled
Disabled state of the button
protected
bool
$disabled
= false
$form
ID of the referenced <form> tag
protected
string
$form
= ''
$icon
Icon object
protected
Icon
$icon
$name
Name Attribute of the button
protected
string
$name
= ''
$onClick
HTML tag attribute onClick Outdated, use sparingly
Use HTML data attrs for GlobalEventHandler or ActionDispatcher instead. Will be removed in TYPO3 v12.0
protected
string
$onClick
= ''
$showLabelText
Defines whether to show the title as a label within the button
protected
bool
$showLabelText
= false
$title
HTML tag attribute for title
protected
string
$title
= ''
$value
Value attribute of the button
protected
string
$value
= ''
Methods
__toString()
Magic method so Fluid can access a button via {button}
public
__toString() : string
Return values
stringgetClasses()
Get classes
public
getClasses() : string
Return values
stringgetDataAttributes()
Get Data attributes
public
getDataAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getForm()
public
getForm() : string
Return values
stringgetIcon()
Get icon
public
getIcon() : Icon
Return values
IcongetName()
Get name
public
getName() : string
Return values
stringgetOnClick()
Get Onclick Attribute
public
getOnClick() : string
Use HTML data attrs for GlobalEventHandler or ActionDispatcher instead. Will be removed in TYPO3 v12.0
Return values
stringgetShowLabelText()
Show Label text
public
getShowLabelText() : bool
Return values
boolgetTitle()
Get Title
public
getTitle() : string
Return values
stringgetType()
Get type
public
getType() : string
Return values
stringgetValue()
Get value
public
getValue() : string
Return values
stringhasOnClick()
Helper method to avoid using `getOnClick` in TYPO3 core.
public
hasOnClick() : bool
Introduced with TYPO3 v11.5, will be removed with TYPO3 v12.0
Basically just to be used by the TYPO3 core, not to be used in extensions.
Return values
boolisDisabled()
Check if button is disabled
public
isDisabled() : bool
Return values
boolisValid()
Validates the current button
public
isValid() : bool
Return values
boolrender()
Renders the markup of the button
public
render() : string
Return values
stringsetClasses()
Set classes
public
setClasses(string $classes) : $this
Parameters
- $classes : string
-
HTML class attribute to set
Return values
$thissetDataAttributes()
Set Data attributes
public
setDataAttributes(array<string|int, mixed> $dataAttributes) : $this
Parameters
- $dataAttributes : array<string|int, mixed>
-
HTML data attributes to set
Return values
$thissetDisabled()
Set if button needs to be disabled
public
setDisabled(bool $disabled) : AbstractButton
Parameters
- $disabled : bool
Return values
AbstractButtonsetForm()
public
setForm(string $form) : InputButton
Parameters
- $form : string
Return values
InputButtonsetIcon()
Set icon
public
setIcon(Icon $icon) : $this
Parameters
- $icon : Icon
-
Icon object for the button
Return values
$thissetName()
Set name
public
setName(string $name) : InputButton
Parameters
- $name : string
-
Name attribute
Return values
InputButtonsetOnClick()
Set OnClick
public
setOnClick(string $onClick) : $this
Use HTML data attrs for GlobalEventHandler or ActionDispatcher instead. Will be removed in TYPO3 v12.0
Parameters
- $onClick : string
-
HTML onClick attribute to set
Return values
$thissetShowLabelText()
Show Label text
public
setShowLabelText(bool $showLabelText) : $this
Parameters
- $showLabelText : bool
Return values
$thissetTitle()
Set title attribute
public
setTitle(string $title) : $this
Parameters
- $title : string
-
HTML title attribute to set
Return values
$thissetValue()
Set value
public
setValue(string $value) : InputButton
Parameters
- $value : string
-
Value attribute