public IViewEngine CreateModulesViewEngine(CreateModulesViewEngineParams parameters) { // Below three lines copied from RazorViewEngineProvider. Must revisit if that class changes. // TBD: It would probably be better to determined the area deterministically from the module of the controller, // not by trial and error. var areaFormats = parameters.ExtensionLocations.Select(location => location + "/{2}/Views/{1}/{0}.liquid").ToArray(); var universalFormats = parameters.VirtualPaths .SelectMany( x => new[] { x + "/Views/{0}.liquid", }) .ToArray(); var viewEngine = new LiquidViewEngine(_liquidTemplateServiceWork) { MasterLocationFormats = DisabledFormats, ViewLocationFormats = universalFormats, PartialViewLocationFormats = universalFormats, AreaMasterLocationFormats = DisabledFormats, AreaViewLocationFormats = areaFormats, AreaPartialViewLocationFormats = areaFormats, }; return viewEngine; }
public IViewEngine CreateModulesViewEngine(CreateModulesViewEngineParams parameters) { var areaFormats = new[] { "~/Core/{2}/Views/{1}/{0}.php", "~/Modules/{2}/Views/{1}/{0}.php", "~/Themes/{2}/Views/{1}/{0}.php", }; var universalFormats = parameters.VirtualPaths .SelectMany( x => new[] { x + "/Views/{0}.php", }) .ToArray(); var viewEngine = new PhpViewEngine(_phpRuntimeWork) { MasterLocationFormats = DisabledFormats, ViewLocationFormats = universalFormats, PartialViewLocationFormats = universalFormats, AreaMasterLocationFormats = DisabledFormats, AreaViewLocationFormats = areaFormats, AreaPartialViewLocationFormats = areaFormats, }; return viewEngine; }
public IViewEngine CreateModulesViewEngine(CreateModulesViewEngineParams parameters) { var areaFormats = new[] { "~/Core/{2}/Views/{1}/{0}.ascx", "~/Core/{2}/Views/{1}/{0}.aspx", "~/Modules/{2}/Views/{1}/{0}.ascx", "~/Modules/{2}/Views/{1}/{0}.aspx", }; Logger.Debug("AreaFormats (module): \r\n\t-{0}", string.Join("\r\n\t-", areaFormats)); var universalFormats = parameters.VirtualPaths .SelectMany(x => new[] { x + "/Views/{0}.ascx", x + "/Views/{0}.aspx", }) .ToArray(); Logger.Debug("UniversalFormats (module): \r\n\t-{0}", string.Join("\r\n\t-", universalFormats)); var viewEngine = new WebFormViewEngine { MasterLocationFormats = DisabledFormats, ViewLocationFormats = universalFormats, PartialViewLocationFormats = universalFormats, AreaMasterLocationFormats = DisabledFormats, AreaViewLocationFormats = areaFormats, AreaPartialViewLocationFormats = areaFormats, }; return viewEngine; }