Skip to content

Alert

Static Alerts

This alerts are hardcoded with the content of the view xml

<alert alert_type="warning" title="Warning"
text="This is a warning notice about copywriting." />

text is a Required attribute.

In this case is a alert with type warning, types supported are:

  • warning
  • success
  • info
  • error




Add actions to alerts New

<alert alert_type="warning" title="Warning"
text="This is a warning notice about copywriting.">
<button string="Fix this issue" type="object" name="fix_issue"
icon="thunderbolt" />
<button string="Ignore" type="object" name="ignore_issue"
icon="audio-muted" />
</alert>

Dynamic Alerts

v2.39.0

You can also create dynamic alerts using the widget with a <field /> tag, this field must be the type of json and must have the following structure:

{
"alertType": "warning",
"title": "Warning",
"text": "This is a warning notice about copywriting."
}

And with the following xml:

<field name="field_name" widget="alert" />

You can also add static and dynamic buttons to the dynamic alert with the following json and xml:

{
"alertType": "warning",
"title": "Warning",
"text": "This is a warning notice about copywriting.",
"buttons": [
{
"string": "Ignore",
"buttonType": "object",
"name": "ignore_issue",
"icon": "audio-muted"
}
]
}

You can see all the available attributes for the buttons in the button component. The only different attribute is buttonType which is the same as the type attribute in the button component.

<field name="field_name" widget="alert">
<button string="Fix this issue" type="object" name="fix_issue"
icon="thunderbolt" />
</field>

API

PropertyDescriptionTypeDefaultVersion
alert_typeType of alert"success" | "warning" | "info" | "error"info-
titleTitle of the alertstring--
textRequired. Description of the alertstring--

Can have children elements of type button.