/// <summary> /// Adds host and tenant level services for managing themes. /// </summary> public static OrchardCoreBuilder AddTheming(this OrchardCoreBuilder builder) { builder.AddThemingHost() .ConfigureServices(services => { services.Configure <MvcOptions>((options) => { options.Filters.Add(typeof(ModelBinderAccessorFilter)); options.Filters.Add(typeof(NotifyFilter)); }); services.AddScoped <IUpdateModelAccessor, LocalModelBinderAccessor>(); services.Configure <RazorViewEngineOptions>(options => { options.FileProviders.Add(new ThemingFileProvider()); }); services.AddScoped <IShapeTemplateViewEngine, RazorShapeTemplateViewEngine>(); services.AddSingleton <IApplicationFeatureProvider <ViewsFeature>, ThemingViewsFeatureProvider>(); services.AddScoped <IViewLocationExpanderProvider, ThemeAwareViewLocationExpanderProvider>(); services.AddScoped <IShapeTemplateHarvester, BasicShapeTemplateHarvester>(); services.AddTransient <IShapeTableManager, DefaultShapeTableManager>(); services.AddScoped <IShapeTableProvider, ShapeAttributeBindingStrategy>(); services.AddScoped <IShapeTableProvider, ShapePlacementParsingStrategy>(); services.AddScoped <IShapeTableProvider, ShapeTemplateBindingStrategy>(); services.TryAddEnumerable( ServiceDescriptor.Transient <IConfigureOptions <ShapeTemplateOptions>, ShapeTemplateOptionsSetup>()); services.TryAddSingleton <IShapeTemplateFileProviderAccessor, ShapeTemplateFileProviderAccessor>(); services.AddShapeAttributes <CoreShapes>(); services.AddScoped <IShapeTableProvider, CoreShapesTableProvider>(); services.AddShapeAttributes <ZoneShapes>(); services.AddScoped <IShapeTableProvider, LayoutShapes>(); services.AddScoped <IHtmlDisplay, DefaultHtmlDisplay>(); services.AddScoped <ILayoutAccessor, LayoutAccessor>(); services.AddScoped <IThemeManager, ThemeManager>(); services.AddScoped <IPageTitleBuilder, PageTitleBuilder>(); services.AddScoped <IShapeFactory, DefaultShapeFactory>(); services.AddScoped <IDisplayHelperFactory, DisplayHelperFactory>(); services.AddScoped <INotifier, Notifier>(); services.AddScoped(typeof(IPluralStringLocalizer <>), typeof(PluralStringLocalizer <>)); services.AddShapeAttributes <DateTimeShapes>(); services.AddTagHelpers(typeof(BaseShapeTagHelper).Assembly); }); return(builder); }
/// <summary> /// Adds host and tenant level services for managing themes. /// </summary> public static OrchardCoreBuilder AddTheming(this OrchardCoreBuilder builder) { builder.AddThemingHost() .ConfigureServices(services => { services.Configure <MvcOptions>((options) => { options.Filters.Add(typeof(ModelBinderAccessorFilter)); options.Filters.Add(typeof(NotifyFilter)); options.Filters.Add(typeof(RazorViewActionFilter)); }); // Used as a service when we create a fake 'ActionContext'. services.AddScoped <IAsyncViewActionFilter, RazorViewActionFilter>(); services.AddScoped <IUpdateModelAccessor, LocalModelBinderAccessor>(); services.AddScoped <ViewContextAccessor>(); services.AddScoped <IShapeTemplateViewEngine, RazorShapeTemplateViewEngine>(); services.AddSingleton <IApplicationFeatureProvider <ViewsFeature>, ThemingViewsFeatureProvider>(); services.AddScoped <IViewLocationExpanderProvider, ThemeViewLocationExpanderProvider>(); services.AddScoped <IShapeTemplateHarvester, BasicShapeTemplateHarvester>(); services.AddTransient <IShapeTableManager, DefaultShapeTableManager>(); services.AddScoped <IShapeTableProvider, ShapeAttributeBindingStrategy>(); services.AddScoped <IShapeTableProvider, ShapePlacementParsingStrategy>(); services.AddScoped <IShapeTableProvider, ShapeTemplateBindingStrategy>(); services.AddScoped <IPlacementNodeFilterProvider, PathPlacementNodeFilterProvider>(); services.AddScoped <IShapePlacementProvider, ShapeTablePlacementProvider>(); services.TryAddEnumerable( ServiceDescriptor.Transient <IConfigureOptions <ShapeTemplateOptions>, ShapeTemplateOptionsSetup>()); services.TryAddSingleton <IShapeTemplateFileProviderAccessor, ShapeTemplateFileProviderAccessor>(); services.AddShapeAttributes <CoreShapes>(); services.AddScoped <IShapeTableProvider, CoreShapesTableProvider>(); services.AddShapeAttributes <ZoneShapes>(); services.AddScoped <IShapeTableProvider, ZoneShapeAlternates>(); services.AddShapeAttributes <GroupShapes>(); services.AddScoped(typeof(IDisplayManager <>), typeof(DisplayManager <>)); services.AddScoped <IHtmlDisplay, DefaultHtmlDisplay>(); services.AddScoped <ILayoutAccessor, LayoutAccessor>(); services.AddScoped <IThemeManager, ThemeManager>(); services.AddScoped <IPageTitleBuilder, PageTitleBuilder>(); services.AddScoped <IShapeFactory, DefaultShapeFactory>(); services.AddScoped <IDisplayHelper, DisplayHelper>(); services.AddScoped <INotifier, Notifier>(); services.AddShapeAttributes <DateTimeShapes>(); services.AddShapeAttributes <PageTitleShapes>(); services.AddTagHelpers <AddAlternateTagHelper>(); services.AddTagHelpers <AddClassTagHelper>(); services.AddTagHelpers <AddWrapperTagHelper>(); services.AddTagHelpers <ClearAlternatesTagHelper>(); services.AddTagHelpers <ClearClassesTagHelper>(); services.AddTagHelpers <ClearWrappersTagHelper>(); services.AddTagHelpers <InputIsDisabledTagHelper>(); services.AddTagHelpers <RemoveAlternateTagHelper>(); services.AddTagHelpers <RemoveClassTagHelper>(); services.AddTagHelpers <RemoveWrapperTagHelper>(); services.AddTagHelpers <ShapeMetadataTagHelper>(); services.AddTagHelpers <ShapeTagHelper>(); services.AddTagHelpers <ValidationMessageTagHelper>(); services.AddTagHelpers <ZoneTagHelper>(); }); return(builder); }