Curious if there is scope to allow Themes to provide overrides for Admin Views?
I noted that in ThemeableViewLocationExpander if the following changes were made, it appears to provide the functionality to override the Admin views.
public void PopulateValues(ViewLocationExpanderContext context)
{
//no need to add the themeable view locations at all as the administration should not be themeable anyway
// if (context.AreaName?.Equals(AreaNames.ADMIN) ?? false)
// return;
context.Values[THEME_KEY] = EngineContext.Current.Resolve<IThemeContext>().GetWorkingThemeNameAsync().Result;
}
public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations)
{
// {2} area , {1} controller , {0} action
if (context.Values.TryGetValue(THEME_KEY, out var theme))
{
viewLocations = new[] {
$"/Themes/{theme}/Views/{{1}}/{{0}}.cshtml",
$"/Themes/{theme}/Views/Shared/{{0}}.cshtml",
//Admin area
$"/Themes/{theme}/Areas/{{2}}/Views/{{1}}/{{0}}.cshtml",
$"/Themes/{theme}/Areas/{{2}}/Views/Shared/{{0}}.cshtml",
}
.Concat(viewLocations);
}
return viewLocations;
}
Then adding the custom views to your theme under path /Themes/{Theme}/Areas/Admin/Views/ path (Along with the _ViewStart and _ViewImports files)
There was a prior discussion (12yrs ago) here but I couldn't see a resolution https://www.nopcommerce.com/en/boards/topic/13861/custom-theme-and-admin-views
If this is useful I can do up a PR.