Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
Experience Sitecore! | Productivity Improvement: Layout Details - click an icon to look-up or modify layouts / sublayouts / renderings

Experience Sitecore!

Martin Miles on Sitecore

Productivity Improvement: Layout Details - click an icon to look-up or modify layouts / sublayouts / renderings

Introduction: I enjoy finding some improvements around default Sitecore interfaces, especially Layout Details, so that is my third post already (previous were Creating a Presentation Exists gutter - get even faster access to item's Presentation Details and The quickest access to Layout Details dialog of Presentation Details)


This time it will be a feature that I have been highly missing with time - ability to look-up layouts and renderings definitions quickly right from Layout Details dialog window. Just as a case, a Sitecore instance may have hundreds of renderings located across various projects. You may look the presentation details for a page, but it has multiple controller renderings and you do not have a clue about what exact controller and action do they rely on. Right, here is the solution.


If you click by the renderings names - that would work as expected, opening Control Properties where you usually specify placeholder and the datasource for that rendering. But if you click the icon right hand side - it will open a popup with your rendering pre-selected and loaded, so you can easily see its properties, like controller / rendering or view path (for view renderings or sublayouts). That also works in the same manner when clicking layout icon above.


Implementation: control, that represents dialog is located at <web_root>\sitecore\shell\Applications\Content Manager\Dialogs\LayoutDetails\LayoutDetails.xml files. We inherit from its codebeside class and reference it from xmlcontrol:

<!-- replace original Codebesides reference with: -->
<CodeBeside Type="LayoutDetailsShortcuts.LayoutDetailsForm, LayoutDetailsShortcuts" />

The way Sitecore is written internally has is multiple coupled classes with private methods, so I had to take them all (from Sitecore. Client library) as is only just to satisfy dependencies and make my code compile and work.

The only class to be changed is LayoutGridBuilder having two methods BuildDevice() and BuildRendering() where amendments take place. You may also see GitHub repository with the code.


Downloads: You can download ready-to-use package as well as anti-package (to revert back original files to original behavior) for Sitecore 8. Please let me know (or twit) if you like that.

    Layout Details Shortcuts 1.1.zip (10.8KB)
    LayoutDetailsShortcuts-1.1-ANTI-PACKAGE.zip (3.4KB)

The source code can be accessed at GitHub by this link.

Known minor issue: when you click at any rendering name (not the icon, as highlighted on a image below) it will open Control Properties dialog and when you return back from that dialog - look-up links will not work and control will return to default behavior.

The reason for such a behavior is that on returning back Sitecore runs a series of pipelines that eventually call original LayoutDetailsForm class from Sitecore.Client rather than the one we have overridden and referenced above. Fixing that requires patching original DLL and I highly wanted to avoid inclining into any original functionality (moreover, you are not likely allowed to do that by license).


Hope you find this post helpful!

blog comments powered by Disqus