SplitButton extends AbstractButton
SplitButton
This button type renders a bootstrap split button. It takes multiple button objects as parameters
EXAMPLE USAGE TO ADD A SPLIT 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', IconSize::SMALL)) ->setTitle('Save');
$saveAndCloseButton = $buttonBar->makeInputButton() ->setName('save_and_close') ->setValue('1') ->setTitle('Save and close') ->setIcon($this->iconFactory->getIcon('actions-document-save-close', IconSize::SMALL));
$saveAndShowPageButton = $buttonBar->makeInputButton() ->setName('save_and_show') ->setValue('1') ->setTitle('Save and show') ->setIcon($this->iconFactory->getIcon('actions-document-save-view', IconSize::SMALL));
$splitButtonElement = $buttonBar->makeSplitButton() ->addItem($saveButton, TRUE) ->addItem($saveAndCloseButton) ->addItem($saveAndShowPageButton);
Table of Contents
Properties
- $classes : string
- HTML tag attribute for class
- $containsPrimaryAction : bool
- Internal var that determines whether the split button has received any primary actions yet
- $dataAttributes : array<string|int, mixed>
- HTML tag attributes for data-* Use key => value pairs
- $disabled : bool
- Disabled state of the button
- $icon : Icon
- Icon object
- $items : array<string|int, mixed>
- Internal array of items in the split button
- $showLabelText : bool
- Defines whether to show the title as a label within the button
- $title : string
- HTML tag attribute for title
Methods
- __toString() : string
- Magic method so Fluid can access a button via {button}
- addItem() : $this
- Adds an instance of any button to the split button
- getButton() : array<string|int, mixed>
- Returns the current button
- getClasses() : string
- Get classes
- getDataAttributes() : array<string|int, mixed>
- Get Data attributes
- getIcon() : Icon
- Get icon
- getShowLabelText() : bool
- Show Label text
- getTitle() : string
- Get Title
- getType() : string
- Get type
- isDisabled() : bool
- Check if button is disabled
- isValid() : bool
- Validates the current button
- render() : string
- Renders the HTML markup of the button
- setClasses() : $this
- Set classes
- setDataAttributes() : $this
- Set Data attributes
- setDisabled() : AbstractButton
- Set if button needs to be disabled
- setIcon() : $this
- Set icon
- setShowLabelText() : $this
- Show Label text
- setTitle() : $this
- Set title attribute
Properties
$classes
HTML tag attribute for class
protected
string
$classes
= ''
$containsPrimaryAction
Internal var that determines whether the split button has received any primary actions yet
protected
bool
$containsPrimaryAction
= false
$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
$icon
Icon object
protected
Icon
$icon
$items
Internal array of items in the split button
protected
array<string|int, mixed>
$items
= []
$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
= ''
Methods
__toString()
Magic method so Fluid can access a button via {button}
public
__toString() : string
Return values
stringaddItem()
Adds an instance of any button to the split button
public
addItem(AbstractButton $item[, bool $primaryAction = false ]) : $this
Parameters
- $item : AbstractButton
-
ButtonObject to add
- $primaryAction : bool = false
-
Is the button the primary action?
Tags
Return values
$thisgetButton()
Returns the current button
public
getButton() : array<string|int, mixed>
Return values
array<string|int, mixed>getClasses()
Get classes
public
getClasses() : string
Return values
stringgetDataAttributes()
Get Data attributes
public
getDataAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getIcon()
Get icon
public
getIcon() : Icon
Return values
IcongetShowLabelText()
Show Label text
public
getShowLabelText() : bool
Return values
boolgetTitle()
Get Title
public
getTitle() : string
Return values
stringgetType()
Get type
public
getType() : string
Return values
stringisDisabled()
Check if button is disabled
public
isDisabled() : bool
Return values
boolisValid()
Validates the current button
public
isValid() : bool
Return values
boolrender()
Renders the HTML 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
AbstractButtonsetIcon()
Set icon
public
setIcon(Icon $icon) : $this
Parameters
- $icon : Icon
-
Icon object for the button
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