Archive for March, 2016

We had the need to create a module which showed an image with hotspots on it – basically positional tooltips.

We created subitems of the module for each hotspot, and expected the content author to provide the position of the hotspot on the module image – in percentage – relative to the top / left of the image.
Now this posed an issue for the content authors since they had to either guess the position of each hotspot or upload the image onto a different online tool and then get the position from there to add into out hotspot sub items.

To remedy this we created a tool and integrated it with the Sitecore Content Editor – which would allow the content author to just click on the points on the image and create the corresponding hotspots.

To make this tool more versatile, we have made it configurable, so it can be used with any instance of Sitecore and any module, as long as it is configured in the hotspot specific configuration xml.

Here’s an example of the end result:

To achieve this, we needed to implement the following steps:

Create an aspx page in your solution which Sitecore will load as a tab in the content editor.

Create an Editor item in Core DB, which will point to the aspx page you created.

Set the Editor item on the standard values item of the template which would have the image on which the hotspots need to be set.

Add the relevant code in the aspx page.

Create an aspx page in your solution

In our solution, we added the aspx page in the following location:

Create an Editor item in Core DB

Set the Editor item on the standard values item of the template

In this example, we have a POI module datasource template – which will have the image field for which we want to create the hotspots / points of interest. So we will set this editor in the standard values of this datasource template.

ASPX page code

We have the back end and front end code here. From a usability perspective, the current code only enables the content author to create new hotpot / point of interest items. Editing / deleting hotpot / point of interest items can be done directly at the individual hotspot level. Additionally, to make it convenient for a content author to identify which hotspot they want to edit / delete, on load of the tab, we have front end code, which shows the current set of hotspots that already exist as sub items.

While the top / left coordinate % is auto populated by this tool, we have an optional field for the tooltip description which a content author can choose to populate before creating the hotspot.

Futher, in our project, we have tried to make this tool as configurable as possible! So now, we can use this tool on any module, by making sitecore and config updates!

In the above code, you’ll see that we are reading some configuration from an xml file. What we are essentially doing in this xml file, is specifying by template, which field will contain the image that we need to load in the hotspot tab, and the hotspot item template to use. We are using the same base template for hotspots, which is why you see the field names hardcoded in the code above. You could however include these field names also in the xml configuration if your field names between templates are likely to change!