View presentation control code path


How many times did you need to quickly view the code path of say a sublayout control from the presentation settings of an item? This is especially true when multiple developers are working on a Sitecore project or you need to review an existing Sitecore project code.  

The normal process is to select the control, click on “Change” so that you are shown its path relative to “Sublayouts” folder in Sitecore content tree. You then need to go to that sublayout in content tree and then finally check the value of field “Ascx file” to find the exact location of the code-behind file in the solution.

How easy it would be to select a sublayout control and find the location of the code-behind in the Sitecore visual studio solution on click of a button. Well this is exactly what this module would do.

 

Once you install this package (“ViewDetails.zip” attached below) these two new files would be added:

1- "\Website\sitecore\shell\SublayoutPath.aspx"

2- "\Website\bin\Custom.SitecoreExtensions.dll"

3- You would then have to manually change the file in "\Website\sitecore\shell\Applications\Layouts\DeviceEditor\DeviceEditor.xml". If you are having the same Sitecore version that I have i.e. "8.1 rev. 151207", you can very well replace this file with this custom “DeviceEditor.xml” attached below. Following are the changes needed in this file:

(a)- Comment out this line

<CodeBeside Type="Sitecore.Shell.Applications.Layouts.DeviceEditor.DeviceEditorForm,Sitecore.Client"/>

(b)- Insert this line as a replacement

<CodeBeside Type="Custom.SitecoreExtensions.Dialogs.CustomDeviceEditorForm,Custom.SitecoreExtensions"/>

(c)- At <Tab ID="ControlsTab", <div class="scStretch">, <div class="optionButtons">, insert this following line between <Button Header="Remove" and <Button ID="Test" :

<Button Header="View Controller Code path" ID="btnViewPath" Click="device:view" style="margin-bottom: 6px"/>

 

ViewDetailsPackage

Device Editor XML 

 

SEARCH ARTICLES