class MessageService (View source)

Queues per-page flash messages in the session and renders the bare-HTML fatal error page.

Constants

private TYPE_ERROR

Methods

__construct(UserContextService $userContextService)

No description

void
addMessage(string $script, string $type, string $content, string|null $recordName = null)

Add a message to be displayed for a specific script Prevents duplicate messages from being added

array|null
getMessages(string $script)

Get messages for a specific script and clear them from session

void
addSystemError(string $error, string|null $recordName = null)

Add a system error message that will be displayed in the proper place in the HTML

void
displayDirectSystemError(string $error, bool $exit = true)

Display a system error directly with basic HTML Useful for critical errors before the header/footer can be rendered

Details

__construct(UserContextService $userContextService)

No description

Parameters

UserContextService $userContextService

void addMessage(string $script, string $type, string $content, string|null $recordName = null)

Add a message to be displayed for a specific script Prevents duplicate messages from being added

Parameters

string $script

The script to set the message for

string $type

The type of message (error, warning, success, info)

string $content

The content of the message

string|null $recordName

Optional record name for context

Return Value

void

array|null getMessages(string $script)

Get messages for a specific script and clear them from session

Parameters

string $script

The script to get messages for

Return Value

array|null

The messages for the script, or null if no messages are set

void addSystemError(string $error, string|null $recordName = null)

Add a system error message that will be displayed in the proper place in the HTML

Parameters

string $error

The error message to display

string|null $recordName

Optional record name for context

Return Value

void

void displayDirectSystemError(string $error, bool $exit = true)

Display a system error directly with basic HTML Useful for critical errors before the header/footer can be rendered

Parameters

string $error

The error message to display

bool $exit

False only in tests, which cannot survive the exit

Return Value

void