AbstractDropDownItem implements Stringable
AbstractYes
Base class for all dropdown menu items that can be added to DropDownButton or SplitButton.
Provides common functionality for dropdown items including icon handling, labels, links, custom HTML tags, and active state management.
Implements DropDownItemInterface, providing validation, type identification, and rendering capabilities for all dropdown items.
Table of Contents
Interfaces
- Stringable
Properties
- $active : bool
- Whether this item is currently active/selected
- $attributes : array<string, string>
- Custom HTML attributes for the element
- $href : string|null
- URL/href for link items
- $icon : Icon|null
- Optional icon displayed before the label
- $label : string|null
- Text content/label of the dropdown item
- $tag : string
- HTML tag name for the dropdown item element (e.g., 'a', 'button', custom elements)
- $title : string|null
- Tooltip/title attribute (defaults to label if not explicitly set)
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() : static
- setAttribute() : static
- setAttributes() : static
- setHref() : static
- setIcon() : static
- setLabel() : static
- setTag() : static
- setTitle() : static
- getAttributesString() : string
- getRenderedIcon() : string
Properties
$active
Whether this item is currently active/selected
protected
bool
$active
= false
$attributes
Custom HTML attributes for the element
protected
array<string, string>
$attributes
= []
$href
URL/href for link items
protected
string|null
$href
= null
$icon
Optional icon displayed before the label
protected
Icon|null
$icon
= null
$label
Text content/label of the dropdown item
protected
string|null
$label
= null
$tag
HTML tag name for the dropdown item element (e.g., 'a', 'button', custom elements)
protected
string
$tag
= 'a'
$title
Tooltip/title attribute (defaults to label if not explicitly set)
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
abstract render() : string
Return values
stringsetActive()
public
setActive(bool $active) : static
Parameters
- $active : bool
Return values
staticsetAttribute()
public
setAttribute(string $name, string $value) : static
Parameters
- $name : string
- $value : string
Return values
staticsetAttributes()
public
setAttributes(array<string, string> $attributes) : static
Parameters
- $attributes : array<string, string>
Return values
staticsetHref()
public
setHref(string|null $href) : static
Parameters
- $href : string|null
Return values
staticsetIcon()
public
setIcon(Icon|null $icon) : static
Parameters
- $icon : Icon|null
Return values
staticsetLabel()
public
setLabel(string|null $label) : static
Parameters
- $label : string|null
Return values
staticsetTag()
public
setTag(string $tag) : static
Parameters
- $tag : string
Return values
staticsetTitle()
public
setTitle(string|null $title) : static
Parameters
- $title : string|null
Return values
staticgetAttributesString()
protected
getAttributesString() : string
Return values
stringgetRenderedIcon()
protected
getRenderedIcon() : string