diff --git a/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs b/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs index e454a99f17..507b9fbb6e 100644 --- a/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs +++ b/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs @@ -104,12 +104,6 @@ namespace Umbraco.Web.Macros if (currentPage == null) throw new ArgumentNullException("currentPage"); if (macro.ScriptName.IsNullOrWhiteSpace()) throw new ArgumentException("The ScriptName property of the macro object cannot be null or empty"); - if (!macro.ScriptName.StartsWith(SystemDirectories.MvcViews + "/MacroPartials/") - && (!Regex.IsMatch(macro.ScriptName, "~/App_Plugins/.+?/Views/MacroPartials", RegexOptions.Compiled))) - { - throw new InvalidOperationException("Cannot render the Partial View Macro with file: " + macro.ScriptName + ". All Partial View Macros must exist in the " + SystemDirectories.MvcViews + "/MacroPartials/ folder"); - } - var http = _getHttpContext(); var umbCtx = _getUmbracoContext(); var routeVals = new RouteData(); diff --git a/src/Umbraco.Web/umbraco.presentation/macro.cs b/src/Umbraco.Web/umbraco.presentation/macro.cs index d8914040ac..a3348e76a2 100644 --- a/src/Umbraco.Web/umbraco.presentation/macro.cs +++ b/src/Umbraco.Web/umbraco.presentation/macro.cs @@ -231,8 +231,20 @@ namespace umbraco return renderMacro(pageElements, pageId); } + public delegate void OnMacroRenderingEventHandler(macro sender, EventArgs e); + public static event OnMacroRenderingEventHandler OnMacroRendering; + protected void FireOnMacroRendering(EventArgs e) + { + if (OnMacroRendering != null) + OnMacroRendering(this, e); + } + public Control renderMacro(Hashtable pageElements, int pageId) { + // Event to allow manipulation of Macro Model + var rea = new EventArgs(); + FireOnMacroRendering(rea); + var macroInfo = (Model.MacroType == MacroTypes.Script && Model.Name.IsNullOrWhiteSpace()) ? string.Format("Render Inline Macro, Cache: {0})", Model.CacheDuration) : string.Format("Render Macro: {0}, type: {1}, cache: {2})", Name, Model.MacroType, Model.CacheDuration); @@ -1952,4 +1964,6 @@ namespace umbraco #endregion } + public class MacroRenderingEventArgs : System.EventArgs { } + } \ No newline at end of file