Exemplo n.º 1
0
        public static HtmlString DependencyPlaceholder(this SitecoreHelper sitecoreHelper, string placeholderKey)
        {
            var repository    = new DependentRenderingsRepository();
            var model         = repository.GetComponentScripts(sitecoreHelper.CurrentItem, placeholderKey);
            var output        = new StringBuilder();
            var outputEntries = new List <string>();

            foreach (var script in model)
            {
                var renderingHtml = sitecoreHelper.Rendering(script.RenderingId, new { datasource = script.Datasource });
                outputEntries.Add(renderingHtml.ToString());
            }
            foreach (var html in outputEntries.Distinct())
            {
                output.Append(html);
            }
            return(new HtmlString(output.ToString()));
        }