public override void Build(BuildContext context) { var themes = mThemeSettingsService.GetAllProfiles().ToLookup(x => x.Theme); if (!themes.Any()) { return; } var root = new XElement("ThemeSettings"); context.RecipeDocument.Element("Orchard").Add(root); foreach (var theme in themes) { root.Add(new XElement("Theme", new XAttribute("Name", theme.Key), theme.Select(profile => new XElement("Profile", new XAttribute("Name", profile.Name), new XAttribute("Description", profile.Description ?? ""), new XAttribute("IsCurrent", profile.IsCurrent), new XCData(mThemeSettingsService.SerializeSettings(profile.Settings)))))); } }
public void Exported(ExportContext context) { if (!context.ExportOptions.CustomSteps.Contains("ThemeSettings")) { return; } var themes = _themeSettingsService.GetAllProfiles().ToLookup(x => x.Theme); if (!themes.Any()) { return; } var root = new XElement("ThemeSettings"); context.Document.Element("Orchard").Add(root); foreach (var theme in themes) { root.Add(new XElement("Theme", new XAttribute("Name", theme.Key), theme.Select(profile => new XElement("Profile", new XAttribute("Name", profile.Name), new XAttribute("Description", profile.Description), new XAttribute("IsCurrent", profile.IsCurrent), new XCData(_themeSettingsService.SerializeSettings(profile.Settings)))))); } }