Custom name for rendering in presentation details
Modify the code-behind file of the xml file in
Website\sitecore\shell\Applications\Layouts\DeviceEditor\DeviceEditor.xml
from
<CodeBeside Type="Sitecore.Shell.Applications.Layouts.DeviceEditor.DeviceEditorForm,Sitecore.Client"/>
to
<CodeBeside Type="sitecoreblog.tools4geeks.Applications.Layouts.DeviceEditor.DeviceEditorForm,sitecoreblog.tools4geeks"/>
Duplicate original class with your new class name DeviceEditorForm with above namespace. replace RenderRenderings method with below code
private void RenderRenderings(DeviceDefinition deviceDefinition, int selectedIndex, int index)
{
Assert.ArgumentNotNull((object) deviceDefinition, "deviceDefinition");
ArrayList renderings = deviceDefinition.Renderings;
if (renderings == null)
return;
foreach (RenderingDefinition rendering in renderings)
{
if (rendering.ItemID != null)
{
Item obj = Client.ContentDatabase.GetItem(rendering.ItemID);
XmlControl webControl = Resource.GetWebControl("DeviceRendering") as XmlControl;
Assert.IsNotNull((object) webControl, typeof (XmlControl));
HtmlGenericControl htmlGenericControl1 = new HtmlGenericControl("div");
htmlGenericControl1.Style.Add("padding", "0");
htmlGenericControl1.Style.Add("margin", "0");
htmlGenericControl1.Style.Add("border", "0");
htmlGenericControl1.Style.Add("position", "relative");
htmlGenericControl1.Controls.Add((System.Web.UI.Control) webControl);
string uniqueId = Sitecore.Web.UI.HtmlControls.Control.GetUniqueID("R");
this.Renderings.Controls.Add((System.Web.UI.Control) htmlGenericControl1);
htmlGenericControl1.ID = Sitecore.Web.UI.HtmlControls.Control.GetUniqueID("C");
webControl["Click"] = (object) ("OnRenderingClick(\"" + (object) index + "\")");
webControl["DblClick"] = (object) "device:edit";
if (index == selectedIndex)
webControl["Background"] = (object) "#D0EBF6";
this.Controls.Add((object) uniqueId);
if (obj != null)
{
webControl["ID"] = (object) uniqueId;
webControl["Icon"] = (object) obj.Appearance.Icon;
webControl["Header"] = (object) obj.DisplayName + "-" + (object) rendering.Datasource ;
webControl["Placeholder"] = (object) WebUtil.SafeEncode(rendering.Placeholder);
}
else
{
webControl["ID"] = (object) uniqueId;
webControl["Icon"] = (object) "Applications/24x24/forbidden.png";
webControl["Header"] = (object) "Unknown rendering";
webControl["Placeholder"] = (object) string.Empty;
}
if (rendering.Rules != null && !rendering.Rules.IsEmpty)
{
int num = rendering.Rules.Elements((XName) "rule").Count<XElement>();
if (num > 1)
{
HtmlGenericControl htmlGenericControl2 = new HtmlGenericControl("span");
if (num > 9)
htmlGenericControl2.Attributes["class"] = "scConditionContainer scLongConditionContainer";
else
htmlGenericControl2.Attributes["class"] = "scConditionContainer";
htmlGenericControl2.InnerText = num.ToString();
htmlGenericControl1.Controls.Add((System.Web.UI.Control) htmlGenericControl2);
}
}
RenderDeviceEditorRenderingPipeline.Run(rendering, webControl, (System.Web.UI.Control) htmlGenericControl1);
++index;
}
}
}
This should display rendering name as rendering name - Datasource
RECENT POSTS
POPULAR POSTS
CATEGORIES
- sitecore-unicorn
- sitecore-contacts
- sitecore-xdb
- sitecore-handling-500-errors
- sitecore-bug
- sitecore-media-library
- sitecore-content-editor
- sitecore-patch
- personal-opinions
- programming
- sitecore-error
- sitecore-usermanager
- sitecore-languge-settings
- sitecore-content-language
- microsoft-Bot-Framework
- Chatbot-Beginners
- ChatBot-Emulator
- botFramework
- FirstChatBot
- chatbot
- sitecore-customroutes
- sitecore-api
- sitecore-buckets
- sitecore-wildcards
- sitecore-layoutdetails
- sitecore-modals
- sitecore-client
- sitecore-deviceeditor
- sitecore-best-practises
- sitecore-templates
- sitecore
- sitecore-scheduling
- sitecore-autopublish
- sitecore-autopublish
- extension-method
- sitecore-multisite
- sitecore-events
- sitecore-publishing
- sitecore8.1
- Rendering Parameters
- GlassMapper
- Sitecore