Yes, it can be done, but to change the appearance of individual fields in the content editor, a small amount of code reflection is required, because currently there is no Sitecore pipeline for the content editor at the field level.
- Make the class MyEditorFormatter, which inherits from Sitecore.Shell.Applications.ContentEditor.EditorFormatter.
- Using a tool such as Reflector or DotPeek, copy the implementation of the two methods from the original EditorFormatter to a new class:
public virtual void RenderField(System.Web.UI.Control parent, Editor.Field field, bool readOnly) {...} public void RenderLabel(System.Web.UI.Control parent, Editor.Field field, Item fieldType, bool readOnly) {...}
Note: RenderLabel is a method that writes a field-level tooltip, but since it is not virtual, the only way to override its functionality is to override the RenderField that calls it. - Change the signature of the RenderField from virtual to override . This will call args.EditorFormatter.RenderField to run the new code.
- Paste the desired tooltip logic into the RenderLabel:
if (itemField.Description.Length > 0) { str4 = " title=\"" + itemField.Description + " (custom text)\""; }
Note. You can replace (custom text) with new logic. Also note that you can remove the check on Description.Length, as this will prevent your new tooltip from appearing if the description is empty. Create a pipelined processor to replace Sitecore EditorFormatter with yours:
using Sitecore.Shell.Applications.ContentEditor.Pipelines.RenderContentEditor; namespace CustomizedEditor { public class ChangeToMyEditorFormatter : RenderStandardContentEditor { public void Process(RenderContentEditorArgs args) { args.EditorFormatter = new MyEditorFormatter(); args.EditorFormatter.Arguments = args; } } }
Population EditorFormatter. Arguments are needed to prevent the exclusion of a null object.Add the pipeline processor to the top of the RenderContentEditor pipeline:
<renderContentEditor>
<processor type="CustomizedEditor.ChangeToMyEditorFormatter, CustomizedEditor" />
<processor type="Sitecore.Shell.Applications.ContentEditor.Pipelines.RenderContentEditor.RenderSkinedContentEditor, Sitecore.Client" />
<processor type="Sitecore.Shell.Applications.ContentEditor.Pipelines.RenderContentEditor.RenderStandardContentEditor, Sitecore.Client" />
</renderContentEditor>
Your custom prompt will now appear:

Update: Mike Reynolds wrote a very nice article that shows how this approach can be used to add the "Where this field is defined" feature in the Content Editor.
source share