Ejemplo n.º 1
0
        private static string Plugins(HtmlHelper html, ContentItem item, ControlPanelState state)
        {
            ContentItem start = html.StartPage();
            ContentItem root = html.RootPage();

            Page p = new Page();
            foreach (IControlPanelPlugin plugin in html.ContentEngine().Resolve<IPluginFinder>().GetPlugins<IControlPanelPlugin>())
            {
                var span = new System.Web.UI.HtmlControls.HtmlGenericControl("span");
                span.Attributes["class"] = "control";
                var pluginControl = plugin.AddTo(span, new PluginContext(item, null, start, root, state, html.ContentEngine(), html.ViewContext.HttpContext));

                if (pluginControl != null)
                    p.Controls.Add(span);
            }

            using (var sw = new StringWriter())
            using (var htw = new HtmlTextWriter(sw))
            {
                p.RenderControl(htw);
                return sw.ToString();
            }
        }