TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
SplitButton Class Reference
Inheritance diagram for SplitButton:
AbstractButton ButtonInterface AbstractControl ButtonInterface

Public Member Functions

 addItem (AbstractButton $item, $primaryAction=false)
 
 getButton ()
 
 isValid ()
 
 __toString ()
 
- Public Member Functions inherited from AbstractButton
 getShowLabelText ()
 
 setShowLabelText ($showLabelText)
 
 getIcon ()
 
 getType ()
 
 setIcon (Icon $icon)
 
 isValid ()
 
 __toString ()
 
 render ()
 
- Public Member Functions inherited from AbstractControl
 getClasses ()
 
 getTitle ()
 
 getDataAttributes ()
 
 getOnClick ()
 
 setClasses ($classes)
 
 setTitle ($title)
 
 setDataAttributes (array $dataAttributes)
 
 setOnClick ($onClick)
 

Protected Attributes

 $containsPrimaryAction = false
 
 $items = []
 
- Protected Attributes inherited from AbstractButton
 $icon
 
 $type
 
 $showLabelText = false
 
- Protected Attributes inherited from AbstractControl
 $classes = ''
 
 $title = ''
 
 $dataAttributes = []
 
 $onClick = ''
 

Detailed Description

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', Icon::SIZE_SMALL)) ->setTitle('Save');

$saveAndCloseButton = $buttonBar->makeInputButton() ->setName('save_and_close') ->setValue('1') ->setTitle('Save and close') ->setIcon($this->iconFactory->getIcon('actions-document-save-close', Icon::SIZE_SMALL));

$saveAndShowPageButton = $buttonBar->makeInputButton() ->setName('save_and_show') ->setValue('1') ->setTitle('Save and show') ->setIcon($this->iconFactory->getIcon('actions-document-save-view', Icon::SIZE_SMALL));

$splitButtonElement = $buttonBar->makeSplitButton() ->addItem($saveButton, TRUE) ->addItem($saveAndCloseButton) ->addItem($saveAndShowPageButton);

Definition at line 50 of file SplitButton.php.

Member Function Documentation

__toString ( )

Magic method so Fluid can access a button via {button}

Returns
string

Implements ButtonInterface.

Definition at line 204 of file SplitButton.php.

References AbstractButton\render().

addItem ( AbstractButton  $item,
  $primaryAction = false 
)

Adds an instance of any button to the split button

Parameters
AbstractButton$itemButtonObject to add
bool$primaryActionIs the button the primary action?
Exceptions
InvalidArgumentException In case a button is not valid
Returns
$this

Definition at line 77 of file SplitButton.php.

References AbstractButton\getType(), and AbstractButton\isValid().

getButton ( )

Returns the current button

Returns
array

Definition at line 104 of file SplitButton.php.

References SplitButton\$items.

Referenced by SplitButton\isValid().

isValid ( )

Validates the current button

Returns
bool

Implements ButtonInterface.

Definition at line 119 of file SplitButton.php.

References SplitButton\getButton().

Member Data Documentation

$containsPrimaryAction = false
protected

Definition at line 58 of file SplitButton.php.

$items = []
protected

Definition at line 65 of file SplitButton.php.

Referenced by SplitButton\getButton().