Skip to main content

Hi there,

Today a very easy blog-post, but still a nice to know tip from my side.

I was working on some small functionality for news items. In my current project we have buckets full with news items and we’re using a wildcard-page to render these out. Sometimes content editors want to quickly know what the url will be of a certain news item relative to the site. So I thought let’s add a processor to the GetContentEditorWarnings pipeline for this.

So here’s a default implementation

By default it renders out as a ‘yellow warning’ with a ‘warning icon’.

How to set a Sitecore Content Editor Warning as 'Information' and not as 'Warning'

Since I didn’t really like the fact that it’s a ‘Warning’, but more ‘Information’ for the content author, I investigated where that specific ‘scWarning’ class is set that makes everything yellow. It turns out that is happening in the following class:

  • Sitecore.Shell.Applications.ContentManager.Editor (in the Sitecore.Client dll)

In there there’s the following logic

So as we can see when the icon contains ‘information’ it will change the class to ‘scInformation’, and that’s just what I wanted. So when we now adjust out logic like this:

The result of this that we get a nice blue ‘Information’ notification in the content editor of Sitecore.

How to set a Sitecore Content Editor Warning as 'Information' and not as 'Warning'

And that’s it. So simple ๐Ÿ˜‰

Happy Sitecore-ing!