Modified the MacroRendering event as requested. Removed the unnecessary check for the file path from the Partial View Macro as it would not be hit anyhow since the macro engine is determined using the same rule. U4-2644 & U4-2643
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -231,20 +231,20 @@ namespace umbraco
|
||||
return renderMacro(pageElements, pageId);
|
||||
}
|
||||
|
||||
public delegate void RenderEventHandler(MacroModel sender, RenderEventArgs e);
|
||||
public new static event RenderEventHandler BeforeRender;
|
||||
protected virtual void FireBeforeRender(RenderEventArgs e)
|
||||
public delegate void OnMacroRenderingEventHandler(macro sender, EventArgs e);
|
||||
public static event OnMacroRenderingEventHandler OnMacroRendering;
|
||||
protected void FireOnMacroRendering(EventArgs e)
|
||||
{
|
||||
if (BeforeRender != null)
|
||||
BeforeRender(Model, e);
|
||||
if (OnMacroRendering != null)
|
||||
OnMacroRendering(this, e);
|
||||
}
|
||||
|
||||
|
||||
public Control renderMacro(Hashtable pageElements, int pageId)
|
||||
{
|
||||
// Event to allow manipulation of Macro Model
|
||||
var rea = new RenderEventArgs();
|
||||
FireBeforeRender(rea);
|
||||
var rea = new EventArgs();
|
||||
FireOnMacroRendering(rea);
|
||||
|
||||
|
||||
var macroInfo = (Model.MacroType == MacroTypes.Script && Model.Name.IsNullOrWhiteSpace())
|
||||
@@ -1966,6 +1966,6 @@ namespace umbraco
|
||||
|
||||
#endregion
|
||||
}
|
||||
public class RenderEventArgs : System.ComponentModel.CancelEventArgs { }
|
||||
public class MacroRenderingEventArgs : System.EventArgs { }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user