SwatObject
└─SwatMessage
public class SwatMessage
extends SwatObject
| Field Summary | |
|---|---|
| final mixed | Error message type. |
| final mixed | Notification message type. |
| final mixed | System Error message type. |
| final mixed | Warning message type. |
| string | Optional content type for both primary and secondary content. |
| string | Primary message content. |
| string | Secondary message text. |
| string | Type of message. |
| Constructor Summary | |
|---|---|
SwatMessage(string primary_content, string type) Creates a new SwatMessage. |
|
| Method Summary | |
|---|---|
| string | Gets the CSS class names of this message as a string. |
| string | An alias for SwatMessage::getCSSClassString(). |
public final mixed ERROR = 'error'
Error message type
An error message that requires the attention of the user and that is expected/handled by the application. eg. Missing required fields
public final mixed NOTIFICATION = 'notice'
Notification message type
An informative message that doesn't require any action by the user.
public final mixed SYSTEM_ERROR = 'system-error'
System Error message type
A system error that requires the attention of the user. eg. Database connection error
public final mixed WARNING = 'warning'
Warning message type
A warning message that requires the attention of the user, but is not critical and does not necessarily require any action by the user.
public string $content_type = 'text/plain'
Optional content type for both primary and secondary content
Default text/plain, use text/xml for XHTML fragments.
public string $primary_content = null
Primary message content
The primary message content is a brief description. It should be about one sentence long.
public string $secondary_content = null
Secondary message text
The secondary message content is an optional longer description. Its length should be at most the length of a small paragraph.
public string $type
Type of message
public SwatMessage(string primary_content, string type)
Creates a new SwatMessage
primary_content - the primary text of the message.type - optional. The type of message. If not specified, 'notice' is used.public string getCSSClassString()
Gets the CSS class names of this message as a string
public string getCssClass()
An alias for SwatMessage::getCSSClassString()
A data class to store a message
SwatMessage objects are used thoughout Swat. The most noticeable place they are used is for validating entry widgets. See also
SwatMessageDisplay, a control for displaying messages.A message has primary text, optional secondary text and a type. In order to ease the creation of new messages types, message types are not strictly defined. There are, however, several conventional message types. They are:
Messages do not have to use one of these types, but if they do, the message will automatically be appropriately styled by Swat.