The Content Editor Warnings are these yellow boxes that hover over your content in the Content Editor in Sitecore:

In the old days we would make them by hooking into the getContentEditorWarnings pipeline. Nowadays we use the Sitecore Rules engine. So to make your own Content Editor Warning you need to:
- Create a custom Condition.
- Create the code for the custom Condition
- Create a new Rule
STEP 1: CREATE A CUSTOM CONDITION

Conditions are placed under:
/sitecore/system/Settings/Rules/Definitions/Elements
You can create your own folder in this structure and create a “Condition“. The “Text” field should contain the text displayed in the Rule editor, and the “Type” field should contain the reference to the class containing the code, for example:
MyCode.Rules.MyRule, MyDll
STEP 2: CREATE THE CODE
A condition inherits from a RuleContext. Rules can return different things, my return true or false, but you can create rules that return values like integers or strings.
This is my Rule:
using Sitecore.Diagnostics;
using Sitecore.Data.Items;
using Sitecore.Rules;
using Sitecore.Rules.Conditions;
namespace MyCode.Rules
{
public class MyRule<T> : WhenCondition<T> where T : RuleContext
{
protected override bool Execute(T ruleContext)
{
Assert.ArgumentNotNull(ruleContext, "ruleContext");
// This is them item being clicked on
Item item = ruleContext.Item;
// Pseudocode, imagine that you are checking
// something
if (something == true)
return true;
return false;
}
}
}
STEP 3: CREATE A NEW RULE
Content Editor Warning rules are placed in:
/sitecore/system/Settings/Rules/Content Editor Warnings/Rules
And you need to create a new Content Editor Warning Rule.
Then you create the rule using the rules editor:
My rule is fancy, as a first check for a specific template type (built in rule), then check for my own rule.
Lastly, the rule ends with what should happen. Here you type in the text that should appear in the content editor warning.
That’s it. You are now a Sitecore expert.
MORE TO READ:
- How To Use Sitecore Rules field from SitecoreTweaks
- Lets use that rules engine! by Jeff Darchuck
- Custom rules and conditions for Sitecore personalization by briancaos (old, but the code still checks out)
- How to add a custom condition to appear in marketing automation “rules” panel? from StackExchange
- Sitecore- How to Create Custom Personalization Rules by Ankit Joshi