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
string

getAttributes()

public getAttributes() : array<string, string>
Return values
array<string, string>

getHref()

public getHref() : string|null
Return values
string|null

getLabel()

public getLabel() : string|null
Return values
string|null

getTag()

public getTag() : string
Return values
string

getTitle()

public getTitle() : string|null
Return values
string|null

getType()

public getType() : string
Return values
string

isActive()

public isActive() : bool
Return values
bool

isValid()

public isValid() : bool
Return values
bool

render()

public abstract render() : string
Return values
string

setActive()

public setActive(bool $active) : static
Parameters
$active : bool
Return values
static

setAttribute()

public setAttribute(string $name, string $value) : static
Parameters
$name : string
$value : string
Return values
static

setAttributes()

public setAttributes(array<string, string> $attributes) : static
Parameters
$attributes : array<string, string>
Return values
static

setHref()

public setHref(string|null $href) : static
Parameters
$href : string|null
Return values
static

setIcon()

public setIcon(Icon|null $icon) : static
Parameters
$icon : Icon|null
Return values
static

setLabel()

public setLabel(string|null $label) : static
Parameters
$label : string|null
Return values
static

setTag()

public setTag(string $tag) : static
Parameters
$tag : string
Return values
static

setTitle()

public setTitle(string|null $title) : static
Parameters
$title : string|null
Return values
static

getAttributesString()

protected getAttributesString() : string
Return values
string

getRenderedIcon()

protected getRenderedIcon() : string
Return values
string

        
On this page

Search results