Message

Drupal. Message

Constructs a new instance of the Drupal.Message class. This provides a uniform interface for adding and removing messages to a specific location on the page.

Constructor

new Message(messageWrapper) → {Drupal.Message~messageDefinition}

Source:
Parameters:
Name Type Description
messageWrapper HTMLElement The zone where to add messages. If no element is provided an attempt is made to determine a default location.
Returns:
Class to add and remove messages.
Type
Drupal.Message~messageDefinition

Methods

(static) announce(message, options)

Source:
Helper to call Drupal.announce() with the right parameters.
Parameters:
Name Type Description
message string Displayed message.
options object Additional data.
Properties
Name Type Attributes Description
announce string <optional>
Screen-reader version of the message if necessary. To prevent a message being sent to Drupal.announce() this should be `''`.
priority string <optional>
Priority of the message for Drupal.announce().
type string <optional>
Message type, can be either 'status', 'error' or 'warning'.

(static) defaultWrapper() → {HTMLElement}

Source:
Attempt to determine the default location for inserting JavaScript messages or create one if needed.
Returns:
The default destination for JavaScript messages.
Type
HTMLElement

(static) getMessageTypeLabels() → {Object}

Source:
Provide an object containing the available message types.
Returns:
An object containing message type strings.
Type
Object

(static) messageInternalWrapper(messageWrapper) → {HTMLElement}

Source:
Function for creating the internal message wrapper element.
Parameters:
Name Type Description
messageWrapper HTMLElement The message wrapper.
Returns:
The internal wrapper DOM element.
Type
HTMLElement

Type Definitions

messageDefinition

Source:
Type:
  • class