diff --git a/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs b/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs index 28e558e358..2b56940e4c 100644 --- a/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs +++ b/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs @@ -57,14 +57,27 @@ namespace Umbraco.Web.Macros { get { return EngineName; } } - public IEnumerable SupportedExtensions - { - get { return new[] {"cshtml", "vbhtml"}; } - } - public IEnumerable SupportedUIExtensions - { - get { return new[] { "cshtml", "vbhtml" }; } - } + + //NOTE: We do not return any supported extensions because we don't want the MacroEngineFactory to return this + // macro engine when searching for engines via extension. Those types of engines are reserved for files that are + // stored in the ~/macroScripts folder and each engine must support unique extensions. This is a total Hack until + // we rewrite how macro engines work. + public IEnumerable SupportedExtensions + { + get { return Enumerable.Empty(); } + //get { return new[] {"cshtml", "vbhtml"}; } + } + + //NOTE: We do not return any supported extensions because we don't want the MacroEngineFactory to return this + // macro engine when searching for engines via extension. Those types of engines are reserved for files that are + // stored in the ~/macroScripts folder and each engine must support unique extensions. This is a total Hack until + // we rewrite how macro engines work. + public IEnumerable SupportedUIExtensions + { + get { return Enumerable.Empty(); } + //get { return new[] { "cshtml", "vbhtml" }; } + } + public Dictionary SupportedProperties { get { throw new NotSupportedException(); } diff --git a/src/umbraco.cms/businesslogic/macro/MacroEngineFactory.cs b/src/umbraco.cms/businesslogic/macro/MacroEngineFactory.cs index aab0899de2..961261b0c3 100644 --- a/src/umbraco.cms/businesslogic/macro/MacroEngineFactory.cs +++ b/src/umbraco.cms/businesslogic/macro/MacroEngineFactory.cs @@ -49,25 +49,56 @@ namespace umbraco.cms.businesslogic.macro EnsureInitialize(); } - public static IEnumerable GetSupportedLanguages() { + /// + /// Returns a collectino of MacroEngineLanguage objects, each of which describes a file extension and an associated macro engine + /// + /// + /// + /// Until the macro engines are rewritten, this method explicitly ignores the PartialViewMacroEngine because this method + /// is essentially just used for any macro engine that stores it's files in the ~/macroScripts folder where file extensions + /// cannot overlap. + /// + [Obsolete("This method is not used and will be removed from the codebase in the future")] + public static IEnumerable GetSupportedLanguages() + { var languages = new List(); - foreach(var engine in GetAll()) { - foreach(string lang in engine.SupportedExtensions) + foreach (var engine in GetAll()) + { + foreach (string lang in engine.SupportedExtensions) + { if (languages.Find(t => t.Extension == lang) == null) + { languages.Add(new MacroEngineLanguage(lang, engine.Name)); + } + } } return languages; } - public static IEnumerable GetSupportedUILanguages() { + /// + /// Returns a collectino of MacroEngineLanguage objects, each of which describes a file extension and an associated macro engine that + /// supports file extension lookups. + /// + /// + /// + /// The PartialViewMacroEngine will never be returned in these results because it does not support searching by file extensions. See + /// the notes in the PartialViewMacroEngine regarding this. + /// + public static IEnumerable GetSupportedUILanguages() + { var languages = new List(); - foreach (var engine in GetAll()) { + foreach (var engine in GetAll()) + { foreach (string lang in engine.SupportedUIExtensions) - if (languages.Find(t => t.Extension == lang) == null) + { + if (languages.All(t => t.Extension != lang)) + { languages.Add(new MacroEngineLanguage(lang, engine.Name)); + } + } } return languages.OrderBy(s => s.Extension); - } + } public static List GetAll() {