CoolCMS API

ModalWindowEvent
in package

Immutable data of a modal window needed to render it.

The target is the unique key of the modal in the registry.

Table of Contents

Properties

$content  : string
$htmlId  : string
$options  : array<string|int, mixed>
$target  : string
$title  : string

Methods

__construct()  : mixed
getContent()  : string
getHtmlId()  : string
getOption()  : mixed
getOptions()  : array<string, mixed>
getStyle()  : string
Returns the display style of the modal (`default`, `modern`, `minimal`, ...).
getTarget()  : string
getTitle()  : string
hasOption()  : bool
isAutoTarget()  : bool
Returns whether the target was generated automatically.
withContent()  : self
withOptions()  : self
withTitle()  : self
generateAutoTarget()  : string
Generates a unique automatic target.

Properties

Methods

__construct()

public __construct([string|null $target = null ][, string|Stringable $title = '' ][, string $content = '' ][, array<string, mixed> $options = [] ]) : mixed
Parameters
$target : string|null = null

unique modal key (null generates one)

$title : string|Stringable = ''

modal title (plain string or translator output)

$content : string = ''

HTML content of the modal

$options : array<string, mixed> = []

settings (size, backdrop, keyboard, style, ...)

getOption()

public getOption(string $key[, mixed $default = null ]) : mixed
Parameters
$key : string
$default : mixed = null

getOptions()

public getOptions() : array<string, mixed>
Return values
array<string, mixed>

getStyle()

Returns the display style of the modal (`default`, `modern`, `minimal`, ...).

public getStyle() : string
Return values
string

hasOption()

public hasOption(string $key) : bool
Parameters
$key : string
Return values
bool

isAutoTarget()

Returns whether the target was generated automatically.

public isAutoTarget() : bool
Return values
bool

withContent()

public withContent(string $content) : self
Parameters
$content : string
Return values
self

withOptions()

public withOptions(array<string, mixed> $options) : self
Parameters
$options : array<string, mixed>
Return values
self

withTitle()

public withTitle(string $title) : self
Parameters
$title : string
Return values
self

generateAutoTarget()

Generates a unique automatic target.

private generateAutoTarget() : string
Return values
string
On this page

Search results