public override void Process(GetChromeDataArgs args) { Assert.ArgumentNotNull(args, "args"); Assert.IsNotNull(args.ChromeData, "Chrome Data"); if ("placeholder".Equals(args.ChromeType, StringComparison.OrdinalIgnoreCase)) { var argument = args.CustomData["placeHolderKey"] as string; var placeholderKey = argument; if (PlaceholderKeyHelper.IsDynamicPlaceholder(placeholderKey)) { placeholderKey = PlaceholderKeyHelper.ExtractPlaceholderKey(placeholderKey); } else { return; } // Handles replacing the displayname of the placeholder area to the master reference if (args.Item != null) { var layout = ChromeContext.GetLayout(args.Item); var item = global::Sitecore.Client.Page.GetPlaceholderItem(placeholderKey, args.Item.Database, layout); if (item != null) { args.ChromeData.DisplayName = item.DisplayName; } if (!string.IsNullOrEmpty(item?.Appearance.ShortDescription)) { args.ChromeData.ExpandedDisplayName = item.Appearance.ShortDescription; } } } }
internal static IEnumerable <string> GetParentRenderingIdsForRendering(string placeholderKey) { if (!PlaceholderKeyHelper.IsDynamicPlaceholder(placeholderKey)) { return(Enumerable.Empty <string>()); } return(placeholderKey.Split(new[] { '/' }, StringSplitOptions.None) .Where(key => key.Contains("_")) .Select(x => x.Substring(x.IndexOf('_') + 1))); }
public new void Process(GetPlaceholderRenderingsArgs args) { Assert.IsNotNull(args, "args"); var placeholderKey = args.PlaceholderKey; if (PlaceholderKeyHelper.IsDynamicPlaceholder(placeholderKey)) { placeholderKey = PlaceholderKeyHelper.ExtractPlaceholderKey(placeholderKey); } else { return; } // Same as Sitecore.Pipelines.GetPlaceholderRenderings.GetAllowedRenderings but with fake placeholderKey Item placeholderItem; if (ID.IsNullOrEmpty(args.DeviceId)) { placeholderItem = Client.Page.GetPlaceholderItem(placeholderKey, args.ContentDatabase, args.LayoutDefinition); } else { using (new DeviceSwitcher(args.DeviceId, args.ContentDatabase)) { placeholderItem = Client.Page.GetPlaceholderItem(placeholderKey, args.ContentDatabase, args.LayoutDefinition); } } List <Item> collection = null; if (placeholderItem != null) { bool flag; args.HasPlaceholderSettings = true; collection = GetRenderings(placeholderItem, out flag); if (flag) { args.CustomData["allowedControlsSpecified"] = true; args.Options.ShowTree = false; } } if (collection != null) { if (args.PlaceholderRenderings == null) { args.PlaceholderRenderings = new List <Item>(); } args.PlaceholderRenderings.AddRange(collection); } }