DropDownRadio extends AbstractDropDownItem implements DropDownItemInterface
DropDownRadio
This dropdown item type renders an element with an active state. Use this element to display a radio-like selection of a state. When set to active, it will show a dot in front of the icon and text to indicate that this is the current selection.
At least 2 of these items need to exist within a dropdown button, so a user has a choice of a state to select.
Example: Viewmode -> List / Tiles
$item = GeneralUtility::makeInstance(DropDownRadio::class) ->setHref('#') ->setActive(true) ->setLabel('List') ->setTitle('List') ->setIcon($this->iconFactory->getIcon('actions-viewmode-list')) ->setAttributes(['data-type' => 'list']); $dropDownButton->addItem($item);
$item = GeneralUtility::makeInstance(DropDownRadio::class) ->setHref('#') ->setActive(false) ->setLabel('Tiles') ->setTitle('Tiles') ->setIcon($this->iconFactory->getIcon('actions-viewmode-tiles')) ->setAttributes(['data-type' => 'tiles']); $dropDownButton->addItem($item);
Table of Contents
Interfaces
Properties
- $active : bool
- $attributes : array<string|int, mixed>
- $href : string|null
- $icon : Icon|null
- $label : string|null
- $tag : string
- $title : string|null
Methods
- __toString() : string
- getAttributes() : array<string, string>
- getHref() : string|null
- getIcon() : Icon|null
- getLabel() : string|null
- getTag() : string
- getTitle() : string|null
- getType() : string
- isActive() : bool
- isValid() : bool
- render() : string
- setActive() : self
- setAttributes() : self
- setHref() : self
- setIcon() : self
- setLabel() : self
- setTag() : self
- setTitle() : self
- getAttributesString() : string
- getRenderedIcon() : string
Properties
$active
protected
bool
$active
= false
$attributes
protected
array<string|int, mixed>
$attributes
= []
$href
protected
string|null
$href
= null
$icon
protected
Icon|null
$icon
= null
$label
protected
string|null
$label
= null
$tag
protected
string
$tag
= 'a'
$title
protected
string|null
$title
= null
Methods
__toString()
public
__toString() : string
Return values
stringgetAttributes()
public
getAttributes() : array<string, string>
Return values
array<string, string>getHref()
public
getHref() : string|null
Return values
string|nullgetIcon()
public
getIcon() : Icon|null
Return values
Icon|nullgetLabel()
public
getLabel() : string|null
Return values
string|nullgetTag()
public
getTag() : string
Return values
stringgetTitle()
public
getTitle() : string|null
Return values
string|nullgetType()
public
getType() : string
Return values
stringisActive()
public
isActive() : bool
Return values
boolisValid()
public
isValid() : bool
Return values
boolrender()
public
render() : string
Return values
stringsetActive()
public
setActive(bool $active) : self
Parameters
- $active : bool
Return values
selfsetAttributes()
public
setAttributes(array<string, string> $attributes) : self
Parameters
- $attributes : array<string, string>
Return values
selfsetHref()
public
setHref(string|null $href) : self
Parameters
- $href : string|null
Return values
selfsetIcon()
public
setIcon(Icon|null $icon) : self
Parameters
- $icon : Icon|null
Return values
selfsetLabel()
public
setLabel(string|null $label) : self
Parameters
- $label : string|null
Return values
selfsetTag()
public
setTag(string $tag) : self
Parameters
- $tag : string
Return values
selfsetTitle()
public
setTitle(string|null $title) : self
Parameters
- $title : string|null
Return values
selfgetAttributesString()
protected
getAttributesString() : string
Return values
stringgetRenderedIcon()
protected
getRenderedIcon() : string