public virtual IRenderResult RenderComponent(ICmsComponent component, IDictionary <string, object> settings, ICmsContext context, ITheme theme) { if (!context.CanRender(component, theme)) { return(new RenderResult("text/plain", x => { }, new Dictionary <Guid, RequestContext>(), context)); } var renderInformation = component.Render(context, settings); if (renderInformation == null) { return(new RenderResult("text/plain", x => { }, new Dictionary <Guid, RequestContext>(), context)); } var contexts = renderInformation.Contexts.ToDictionary(x => Guid.NewGuid(), x => x); contexts[Guid.NewGuid()] = ComponentSettingsContext.Build(settings); return(new RenderResult(renderInformation.ContentType, x => { var renderer = (IRenderer)context.Resolve(typeof(Renderer <>).MakeGenericType(renderInformation.GetType())); renderer.Render(renderInformation, context, theme, x); }, contexts, context)); }
public override IRenderResult RenderComponent(ICmsComponent component, IDictionary<string, object> settings, ICmsContext context, ITheme theme) { var result = component.Render(context, settings) as TextRenderInformation; if(result == null) return new RenderResult("", ""); return new RenderResult(result.ContentType, result.Text); }
public override IRenderResult RenderComponent(ICmsComponent component, IDictionary <string, object> settings, ICmsContext context, ITheme theme) { var result = component.Render(context, settings) as TextRenderInformation; if (result == null) { return(new RenderResult("", "")); } return(new RenderResult(result.ContentType, result.Text)); }
public static IHtmlString Component(this IFubuPage page, ICmsComponent component, IDictionary<string, object> settings = null, ITheme theme = null) { var cmsRenderer = page.ServiceLocator.GetInstance<ICmsRenderer>(); var cmsContext = page.ServiceLocator.GetInstance<ICmsContext>(); theme = theme ?? cmsContext.GetCurrentTheme(); var result = cmsRenderer.RenderComponent(component, settings ?? new Dictionary<string, object>(), cmsContext, theme); return new HtmlString(result.Read()); }
public static IHtmlString Component(this IFubuPage page, ICmsComponent component, IDictionary <string, object> settings = null, ITheme theme = null) { var cmsRenderer = page.ServiceLocator.GetInstance <ICmsRenderer>(); var cmsContext = page.ServiceLocator.GetInstance <ICmsContext>(); theme = theme ?? cmsContext.GetCurrentTheme(); var result = cmsRenderer.RenderComponent(component, settings ?? new Dictionary <string, object>(), cmsContext, theme); return(new HtmlString(result.Read())); }