Adding a GetEnabledThemes() so the WidgetService can get the zones of only enabled themes

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-10-14 15:14:04 -07:00
parent 80a3197349
commit c4621deae3
12 changed files with 93 additions and 16 deletions

View File

@@ -207,10 +207,29 @@ namespace Orchard.Tests.Modules.Themes.Services {
}
}
public IEnumerable<ExtensionDescriptor> EnabledExtensions(ShellDescriptor descriptor) {
var extensions = new[] {
new ExtensionDescriptor {Name = "ThemeOne", ExtensionType = "Theme"},
new ExtensionDescriptor {Name = "ThemeTwo", BaseTheme = "ThemeOne", ExtensionType = "Theme"},
new ExtensionDescriptor {Name = "ThemeThree", BaseTheme = "TheThemeThatIsntThere", ExtensionType = "Theme"},
new ExtensionDescriptor {Name = "ThemeFourBasedOnFive", BaseTheme = "ThemeFiveBasedOnFour", ExtensionType = "Theme"},
new ExtensionDescriptor {Name = "ThemeFiveBasedOnFour", BaseTheme = "ThemeFourBasedOnFive", ExtensionType = "Theme"},
};
foreach (var extension in extensions) {
extension.Features = new[] { new FeatureDescriptor { Extension = extension, Name = extension.Name } };
yield return extension;
}
}
public IEnumerable<FeatureDescriptor> AvailableFeatures() {
return AvailableExtensions().SelectMany(ed => ed.Features);
}
public IEnumerable<FeatureDescriptor> EnabledFeatures(ShellDescriptor descriptor) {
return AvailableExtensions().SelectMany(ed => ed.Features);
}
public IEnumerable<Feature> LoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors) {
return featureDescriptors.Select(FrameworkFeature);
}