MessageService
class MessageService (View source)
Constants
| private TYPE_ERROR |
|
Methods
Add a message to be displayed for a specific script Prevents duplicate messages from being added
Get messages for a specific script and clear them from session
Add a system error message that will be displayed in the proper place in the HTML
Set record name context for the error message
Don't exit the script after displaying the error
Display a system error directly with basic HTML Useful for critical errors before the header/footer can be rendered
Generate a unique form token
Store form data with a specific token
Get stored form data for a token and remove it from the session
Clean up expired form data
Details
__construct(UserContextService|null $userContextService = null)
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
MessageService
withRecordContext(string $recordName)
Set record name context for the error message
MessageService
dontExit()
Don't exit the script after displaying the error
void
displayDirectSystemError(string $error)
Display a system error directly with basic HTML Useful for critical errors before the header/footer can be rendered
string
generateFormToken()
Generate a unique form token
void
storeFormData(string $token, array $data)
Store form data with a specific token
array|null
getFormData(string $token)
Get stored form data for a token and remove it from the session
void
cleanupFormData()
Clean up expired form data