Message view definition

A message view defines how a notification (a message type) is displayed in the Notifications app and what users can do with it. Magnolia’s default message view can display any system notification and allows the user to delete them. For a more advanced example, see the workflow message view in /modules/workflow/messageViews/workflow.

Definition

Here’s how the default view is defined in /modules/admincentral/messageViews/default.yaml. Copy or extend it as a starting point for your own view.

actions:
  deleteNotification:
    implementationClass: info.magnolia.admincentral.apps.notifications.action.DeleteNotificationAndCloseAction
    icon: icon-delete
    class: info.magnolia.admincentral.apps.notifications.action.DeleteNotificationActionDefinition
actionbar:
  defaultAction: delete
  sections:
    notifications:
      groups:
        actions:
          items:
            deleteNotification:
              name: deleteNotification
form:
  tabs:
    notification:
      name: notification
      fields:
        sender:
          class: info.magnolia.ui.form.field.definition.TextFieldDefinition
        subject:
          class: info.magnolia.ui.form.field.definition.TextFieldDefinition
        message:
          class: info.magnolia.ui.form.field.definition.TextFieldDefinition
          rows: 5
Property Description

<view name>

required

Name of view.

     actions

required

An action definition that defines what actions the user can perform on the message. For example, a user can approve or reject a published page.

     form

required

A form definition that defines what message details are displayed in the view, such as the sender and the subject. The form fields are rendered as static text in the message view, not as fillable fields.

     actionbar

required

An action bar definition that references actions defined in the message view or somewhere else. The action bar is displayed on side of the message view.

Using a view in code

To use your custom message view in code, set the view on the info.magnolia.ui.api.message.Message object before sending it.

void sendMessageWithCustomView(String messageText) {
   final Message message = new Message();
   message.setMessage(messageText);
   message.setType(MessageType.INFO);

   // format when referencing a view
   // module-name:view-name (as defined in the configuration)
   message.setView("admincentral:myCustomView");
   messagesManager.sendLocalMessage(message);
}
Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the DX Core docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules