"MySpace" the Content Editor - Customizing the Content Editor via the Rules Engine Part 2 - The Experience Editor

Thursday, March 09, 2017 @ 09:30
MySpace Image

By: Eric Stafford, Sitecore Developer – Yesterday morning, I was asked to implement the Customized Content Editor module on a site Cris (project lead) and I are currently rebuilding. Cris was impressed with the module, but had one request; she requested the modified field names appear in the Experience Editor as well. Without thinking through all the aspects of why her request was valid, I quickly responded that, since the content author can visually see where the field is located that they are editing, the field name is irrelevant. Cris disagreed and brought up a good point. If the content author was to switch back to the Content Editor, they would be confused as to which field they were previously editing. Since we are on a tight deadline (two weeks), she said that, if it was too time consuming, we would implement it in phase two of the project. I finished the task I working on, so I decided to give her request five minutes of research. I quickly discovered Cris’ request would be easy and quick to implement; 30 minutes later it was complete.

The majority of the code that controls the Experience Editor is located in the Sitecore.Kernel and some of its pipelines and settings are referenced in the Sitecore.config. The other code is split up into a few other assemblies, but the code I needed is located in the Sitecore.ExperienceEditor assembly. There is also a corresponding Sitecore.ExperienceEditor.config that contains additional pipelines, WebEdit commands and settings. I found the pipeline I needed and it’s located in getChromeData:

In my project, I created the new pipeline: InitializeChromeCustomFieldDisplayName.cs. Starting on line 13, I get the rules processor object and then I retrieve the first item in the field list where the current field name matches the original field name that is set when the rules are processed.

In the Customized Content Editor config, I patched in my new pipeline:

The field in the Content Editor:

Featured Item Content

The field in the Experience Editor:

Featured Item Summary

Usability preserved, day saved, courtesy of the Sitecore Superman.

Haven't read the other chapters?
Part 1 - "MySpace" the Content Editor - Customizing the Content Editor via the Rules Engine
Part 3 - "MySpace" the Content Editor - Customizing the Content Editor via the Rules Engine