PositionInterface

Interface for buttons that define their own fixed position and group.

Buttons implementing this interface will automatically override the position and group parameters passed to ButtonBar::addButton(), ensuring they always appear in their designated location regardless of what the developer specifies.

This is useful for buttons that should always appear in a consistent location across the backend, such as the ShortcutButton which always appears in the top right corner.

Example implementation:

class MyButton implements ButtonInterface, PositionInterface
{
    public function getPosition(): string
    {
        return ButtonBar::BUTTON_POSITION_RIGHT;
    }

    public function getGroup(): int
    {
        return 90;
    }
}

Usage:

$button = $buttonBar->makeMyButton();
// Position and group are ignored - button defines its own
$buttonBar->addButton($button);

Table of Contents

Methods

getGroup()  : int
Returns the group number for this button.
getPosition()  : string
Returns the position where this button should be rendered.

Methods

getGroup()

Returns the group number for this button.

public getGroup() : int

Groups determine the visual grouping and order of buttons within a position. Lower numbers appear first.

Return values
int

The group number (e.g., 1, 10, 90, 91)

getPosition()

Returns the position where this button should be rendered.

public getPosition() : string
Return values
string

Either ButtonBar::BUTTON_POSITION_LEFT or ButtonBar::BUTTON_POSITION_RIGHT


        
On this page

Search results