Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #6609

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions 10/umbraco-cms/reference/notifications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,36 @@

Umbraco uses notifications to allow people to hook into different workflow processes. This notification pattern is extensible, allowing you to create and publish custom notifications, and other people to observe and hook into your custom processes. This approach can be useful when creating Umbraco packages. For more information on how you create and publish your own notifications, see the [creating and publishing notifications](creating-and-publishing-notifications.md) article.

## Showing messages in the CMS

When handling notifications for CMS actions, you can inform the Umbraco user of the status of your notification by adding to the `notification.Messages` property within the `Handle` function.

Check warning on line 280 in 10/umbraco-cms/reference/notifications/README.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [UmbracoDocs.SentenceLength] Write shorter sentences (less than 25 words). Raw Output: {"message": "[UmbracoDocs.SentenceLength] Write shorter sentences (less than 25 words).", "location": {"path": "10/umbraco-cms/reference/notifications/README.md", "range": {"start": {"line": 280, "column": 1}}}, "severity": "WARNING"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When handling notifications for CMS actions, you can inform the Umbraco user of the status of your notification by adding to the `notification.Messages` property within the `Handle` function.
When handling notifications for CMS actions, you can inform the Umbraco user of the status of your notification. This is done by adding to the `notification.Messages` property within the `Handle` function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks good to me! It reads much better that way


This could be used to inform the user to an additional operation that has been performed, or alert them to an error that has occoured.

For example, in a `ContentTypeSavedNotification`:

```
public void Handle(TemplateSavedNotification notification)
{
bool success = DoAdditionalCode();

if (success)
{
//on success
notification.Messages.Add(new EventMessage("Save Successful",
"The content was saved successfully",
EventMessageType.Success));
}
else
{
//on error
notification.Messages.Add(new EventMessage("An Error occoured",
"Detail about the error",
EventMessageType.Error));
}
}
```

## Samples

Below you can find some articles with some examples using Notifications.
Expand Down
Loading