Created
April 29, 2016 08:35
-
-
Save daniiiol/b9e1a0a715221c7eea0384694ad63c67 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Sitecore.Data.Items; | |
using Sitecore.Shell.Applications.ContentEditor; | |
namespace Custom.Common.Fields | |
{ | |
/// <summary> | |
/// The custom tree list. | |
/// </summary> | |
public class PathTreeList : TreeList | |
{ | |
/// <summary> | |
/// Gets the header value with the path. | |
/// </summary> | |
/// <param name="item">The item.</param> | |
/// <returns> | |
/// Header text for list item. | |
/// </returns> | |
protected override string GetHeaderValue(Item item) | |
{ | |
if (item == null) | |
{ | |
return base.GetHeaderValue(null); | |
} | |
var result = item.DisplayName; | |
var nextItem = item.Parent; | |
while (nextItem != null && !nextItem.TemplateName.Equals("HomeTemplateName", StringComparison.InvariantCultureIgnoreCase)) | |
{ | |
result = $"{nextItem.DisplayName}/{result}"; | |
nextItem = nextItem.Parent; | |
} | |
return result; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment