Class: Message

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

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}

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.

Source:
Returns:

Class to add and remove messages.

Type
Drupal.Message~messageDefinition

Methods

(static) announce(message, options)

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'.

Source:

(static) defaultWrapper() → {HTMLElement}

Attempt to determine the default location for inserting JavaScript messages or create one if needed.

Source:
Returns:

The default destination for JavaScript messages.

Type
HTMLElement

(static) getMessageTypeLabels() → {Object}

Provide an object containing the available message types.

Source:
Returns:

An object containing message type strings.

Type
Object

(static) messageInternalWrapper(messageWrapper) → {HTMLElement}

Function for creating the internal message wrapper element.

Parameters:
Name Type Description
messageWrapper HTMLElement

The message wrapper.

Source:
Returns:

The internal wrapper DOM element.

Type
HTMLElement

Type Definitions

messageDefinition

Type:
  • class
Source: