Wiki source code of Notification Messages API

Last modified by Lucas Charpentier on 2026/10/08 09:42

Hide last authors
Manuel Leduc 1.1 1 == Constructor ==
2
3 The documentation of the constructor can be found in the corresponding legacy documentation [[page>>doc:Documentation.DevGuide.FrontendResources.XWikiNotifications.WebHome||anchor="HUsage"]].
4
5 {{version since="18.4.0RC1,17.10.9"}}
Manuel Leduc 1.2 6 == textFormat() ==
Manuel Leduc 1.1 7
8 Indicates how the text parameter is interpreted by ##XWiki.widgets.Notification##.
9 Callers can check for the presence of this method to decide whether to escape their input:
10
11 * When this method is available, the text parameter is treated as plain text and must not be escaped.
12 * When this method is missing (before 18.4.0RC1/17.10.9), the text parameter is interpreted as HTML and may need to be escaped.
13 The returned value is always the ##"plain"## string.
14 {{/version}}
Lucas Charpentier 2.1 15
16 {{version since="18.9.0RC1"}}
17 == show(text, type, options) ==
18
19 Displays a notification and returns it, so that ##hide()## or ##replace()## can be called on it later. It takes the same parameters as the [[constructor>>doc:Documentation.DevGuide.FrontendResources.XWikiNotifications.WebHome||anchor="HUsage"]] and is equivalent to creating a new ##XWiki.widgets.Notification## object, which displays itself, but it makes that side effect explicit where it is called. As with the constructor, the notification is not displayed when ##options.inactive## is set.
20
21 {{code language="javascript"}}
22 XWiki.widgets.Notification.show('Page saved', 'done');
23 {{/code}}
24 {{/version}}

Get Connected