Try our conversational search powered by Generative AI!

Shamrez Iqbal
Dec 18, 2014
(3 votes)

Adding StartPublishDate to PageTree tooltip

In my previous blog post I demonstrated how to customize the tooltip, but it turned out we needed to add the StartPublishDate property to the Tooltip, and it turned out that the item object in the javascript file did not contain this property, so time for some more hunting.

episerver/cms/Stores/contentstructure/This time I started out in the network tab of F12 showing only XHRs. Looking at the different requests I noticed most of them looked very similar so I had to dig through the contents until I found a call containing PageData and I eventually I found one.


Looking at the URL the data came from something called /Stores/contentstructure/ which ContentStructureStore is handling - which inherits from RestController.

A new customization point was needed. Looking at how this REST-controller retrieved data I noticed that the data was is converted into Model objects using something called ContentStoreModelCreator.

The ContentStoreModelCreator has a constructor which takes an enumerable of IModelTransform. This looked like a promising extension point, searching for implementers of this store I found PopulatePageDataModel. As in the previous post, I created a class inheriting from this class.

What PopulatePageDataModel basically does is, it has an array of property names in an array, and tries using the weakly-typed way of retrieving this data. My class added the “PageStartPublish” to the array, and modified the TransformInstance method to use my collection instead.

   public class MyPopulatePageDataModel : PopulatePageDataModel
        private static readonly string[] PropertyNames = new string[]
        public override void TransformInstance(EPiServer.Core.IContent source, EPiServer.Cms.Shell.UI.Rest.Models.StructureStoreContentDataModel target, IModelTransformContext context)
            PropertyDictionary properties = target.Properties;
            IContent content = source;
            foreach (string key in PropertyNames)
                PropertyData propertyData = content.Property[key];
                if (propertyData != null)
                    properties.Add(key, propertyData.Value);
The next step was to Intercept it in IOC, but the PopulatePageDataModel is marked as a singleton so instead of saying InterceptWith(i=>new CustomPopulatePageDataModel()) the object is created once in the module and its called with InterceptWith(i=>MyCustomPopulatePageDataModel);
  private static void ConfigureContainer(ConfigurationExpression container)
            MyPopulatePageDataModel model = new MyPopulatePageDataModel();
            container.IfTypeMatches(type => type.Equals(typeof(PopulatePageDataModel))).InterceptWith(i => model);

            //Implementations for custom interfaces can be registered here.
There are better ways of implementing a singleton but for the sake of demo I did it in the module, it’s possible that it might be possible to define it some other way in StructureMap as well. Now, when looking at the javascript-object being sent to the getItemToolTip we can see that the PageStartPublish is available and can be added to the tooltip. image
Dec 18, 2014


Please login to comment.
Latest blogs
Join the Content Recommendations Work Smarter webinar May 8th 16.00-16.45 CET with expert Aidan Swain

Learn more about Content Recommendations, with Optimizely’s very own Senior Solutions consultant, Aidan Swain . He will discuss best practices and...

Karen McDougall | Apr 12, 2024

Plugin for Identifying and Bulk Deleting Orphaned Missing Properties in Optimizely

I am aware that the Optimizely World community has extensively discussed this topic, with numerous solutions and code snippets available to help...

Adnan Zameer | Apr 11, 2024 | Syndicated blog

Enhancing the Authoring Experience: Extending the LinkItem

The LinkItem field is one of the most demanded properties by the community, allowing editors to effortlessly create and manage links across pages a...

Santiago Morla | Apr 10, 2024 | Syndicated blog

The distinctions between Optimizely Web Experimentation and Optimizely Feature Experimentation

This blog is part of the series - Unlocking the Power of Experimentation: A Marketer's Insight. Let’s dive into Optimizely's powerful experimentati...

Holly Quilter | Apr 9, 2024