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)); }