CoolCMS API

ModalRegistry
in package

Registry of modal windows kept in the session.

Stores only the data needed to render a modal. The data is removed from the session when the modal closes.

Table of Contents

Constants

SESSION_SECTION  : mixed = 'modalWindows'

Properties

$debugMode  : bool
$section  : SessionSection
$session  : Session

Methods

__construct()  : mixed
clear()  : void
Clears the whole session section (for debugging and reset).
closeAllVisible()  : void
Closes all visible modals (use on a non-AJAX request).
exists()  : bool
Returns whether the modal exists in the registry.
getAllModals()  : array<string, ModalWindowEvent>
Returns all registered modals.
getAllTargets()  : array<string|int, string>
Returns all registered targets.
getModal()  : ModalWindowEvent|null
Returns the `ModalWindowEvent` for the given target.
getVisibleModals()  : array<string, ModalWindowEvent>
Returns only the visible modals.
hide()  : void
Marks the modal as invisible but keeps it in the session.
isVisible()  : bool
Returns whether the modal is visible.
register()  : void
Registers a new modal.
remove()  : void
Removes the modal from the session (called on close).
show()  : void
Marks the modal as visible; an unknown target is ignored.
update()  : void
Updates an existing modal and keeps its visibility.
entry()  : array<string|int, mixed>|null
Returns the modal entry from the session (the array stored by `register()`), null when missing.
log()  : void
Debug logging

Constants

SESSION_SECTION

private mixed SESSION_SECTION = 'modalWindows'

Properties

Methods

__construct()

public __construct(Session $session[, bool $debugMode = false ]) : mixed
Parameters
$session : Session
$debugMode : bool = false

clear()

Clears the whole session section (for debugging and reset).

public clear() : void

closeAllVisible()

Closes all visible modals (use on a non-AJAX request).

public closeAllVisible() : void

exists()

Returns whether the modal exists in the registry.

public exists(string $target) : bool
Parameters
$target : string
Return values
bool

getAllTargets()

Returns all registered targets.

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

hide()

Marks the modal as invisible but keeps it in the session.

public hide(string $target) : void
Parameters
$target : string

isVisible()

Returns whether the modal is visible.

public isVisible(string $target) : bool
Parameters
$target : string
Return values
bool

register()

Registers a new modal.

public register(ModalWindowEvent $event[, bool $visible = false ]) : void
Parameters
$event : ModalWindowEvent

modal data

$visible : bool = false

whether the modal is visible immediately

remove()

Removes the modal from the session (called on close).

public remove(string $target) : void
Parameters
$target : string

show()

Marks the modal as visible; an unknown target is ignored.

public show(string $target) : void
Parameters
$target : string

update()

Updates an existing modal and keeps its visibility.

public update(string $target, ModalWindowEvent $event) : void
Parameters
$target : string
$event : ModalWindowEvent
Tags
throws
InvalidArgumentException

when the modal does not exist

entry()

Returns the modal entry from the session (the array stored by `register()`), null when missing.

private entry(string $target) : array<string|int, mixed>|null
Parameters
$target : string
Return values
array<string|int, mixed>|null

log()

Debug logging

private log(string $message) : void
Parameters
$message : string
On this page

Search results