Flash
- Full name:
\Qubus\Http\Session\Flash
Properties
msgTypes
msgWrapper
msgBefore
msgAfter
closeBtn
stickyCssClass
msgCssClass
cssClassMap
redirectUrl
msgId
session
Methods
__construct
Parameters:
Parameter | Type | Description |
---|---|---|
$session | \Qubus\Http\Session\PhpSession |
Throws:
notice
Notice messages.
Parameters:
Parameter | Type | Description |
---|---|---|
$num | int |
display
Display the flash messages
Parameters:
Parameter | Type | Description |
---|---|---|
$types | mixed|null | (null) print all of the message types (array) print the given message types (string) print a single message type |
$print | bool | Whether to print the data or return it |
hasErrors
See if there are any queued error messages
hasMessages
See if there are any queued message
Parameters:
Parameter | Type | Description |
---|---|---|
$type | string|null | The $msgType |
formatMessage
Format a message
Parameters:
Parameter | Type | Description |
---|---|---|
$msgDataArray | array | Array of message data |
$type | string | The $msgType |
Return Value:
The formatted message
doRedirect
Redirect the user if a URL was given.
clear
Clear the messages from the session data
Parameters:
Parameter | Type | Description |
---|---|---|
$types | mixed | (array) Clear all the message types in array. (string) Only clear the one given message type. |
setMsgWrapper
Set the HTML that each message is wrapped in
Parameters:
Parameter | Type | Description |
---|---|---|
$msgWrapper | string | The HTML that each message is wrapped in. Note: Two placeholders (%s) are expected. The first is the $msgCssClass, The second is the message text. |
setMsgBefore
Prepend string to the message (inside of the message wrapper)
Parameters:
Parameter | Type | Description |
---|---|---|
$msgBefore | string | string to prepend to the message |
setMsgAfter
Append string to the message (inside the message wrapper)
Parameters:
Parameter | Type | Description |
---|---|---|
$msgAfter | string | string to append to the message |
setCloseBtn
Set the HTML for the close button
Parameters:
Parameter | Type | Description |
---|---|---|
$closeBtn | string | HTML to use for the close button |
setStickyCssClass
Set the CSS class for sticky notes
Parameters:
Parameter | Type | Description |
---|---|---|
$stickyCssClass | string | the CSS class to use for sticky messages |
setMsgCssClass
Set the CSS class for messages
Parameters:
Parameter | Type | Description |
---|---|---|
$msgCssClass | string | The CSS class to use for messages |
setCssClassMap
Set the CSS classes for message types
Parameters:
Parameter | Type | Description |
---|---|---|
$msgType | mixed | (string) The message type (array) key/value pairs for the class map |
$cssClass | mixed|null | (string) the CSS class to use (null) not used when $msgType is an array |
Inherited methods
info
Add an info message
Parameters:
Parameter | Type | Description |
---|---|---|
$message | string | The message text |
$redirectUrl | string|null | Where to redirect once the message is added |
$sticky | bool | Sticky the message (hides the close button) |
success
Add a success message
Parameters:
Parameter | Type | Description |
---|---|---|
$message | string | The message text |
$redirectUrl | string|null | Where to redirect once the message is added |
$sticky | bool | Sticky the message (hides the close button) |
warning
Add a warning message
Parameters:
Parameter | Type | Description |
---|---|---|
$message | string | The message text |
$redirectUrl | string|null | Where to redirect once the message is added |
$sticky | bool | Sticky the message (hides the close button) |
error
Add an error message
Parameters:
Parameter | Type | Description |
---|---|---|
$message | string | The message text |
$redirectUrl | string|null | Where to redirect once the message is added |
$sticky | bool | Sticky the message (hides the close button) |
sticky
Add a sticky message
public sticky(string $message, string|null $redirectUrl = null, string $type = MessageType::DEFAULT): object
Parameters:
Parameter | Type | Description |
---|---|---|
$message | string | The message text |
$redirectUrl | string|null | Where to redirect once the message is added |
$type | string | The $msgType |
add
Add a flash message to the session data
public add(string $message, string $type = MessageType::DEFAULT, string|null $redirectUrl = null, bool $sticky = false): object|bool
Parameters:
Parameter | Type | Description |
---|---|---|
$message | string | The message text |
$type | string | The $msgType |
$redirectUrl | string|null | Where to redirect once the message is added |
$sticky | bool | Whether the message is stickied |
Automatically generated on 2025-10-13