AbstractControl

Base class providing common properties for UI controls in the backend.

Provides standard HTML attributes like title, CSS classes, and data attributes that are shared across various component types (buttons, menu items, etc.).

This class is extended by components like:

  • AbstractButton
  • MenuItem

Example (inherited in MenuItem):

public function __construct(
    protected readonly ComponentFactory $componentFactory,
) }

$menuItem = $this->componentFactory->createMenuItem()
    ->setTitle('My Item')              // From AbstractControl
    ->setClasses('custom-class')       // From AbstractControl
    ->setDataAttributes([              // From AbstractControl
        'action' => 'do-something'
    ])
    ->setHref('/target');              // MenuItem-specific

Table of Contents

Properties

$classes  : string
CSS classes to apply to the rendered element
$dataAttributes  : array<string, string>
HTML data-* attributes for the control
$title  : string
Title/label text for the control

Methods

getClasses()  : string
getDataAttributes()  : array<string|int, mixed>
getTitle()  : string
setClasses()  : static
setDataAttributes()  : static
setTitle()  : static

Properties

$classes

CSS classes to apply to the rendered element

protected string $classes = ''

$dataAttributes

HTML data-* attributes for the control

protected array<string, string> $dataAttributes = []

Key-value pairs (e.g., ['action' => 'save'])

$title

Title/label text for the control

protected string $title = ''

Methods

getClasses()

public getClasses() : string
Return values
string

getDataAttributes()

public getDataAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getTitle()

public getTitle() : string
Return values
string

setClasses()

public setClasses(string $classes) : static
Parameters
$classes : string
Return values
static

setDataAttributes()

public setDataAttributes(array<string|int, mixed> $dataAttributes) : static
Parameters
$dataAttributes : array<string|int, mixed>
Return values
static

setTitle()

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

        
On this page

Search results