INode to IPublishedContent transition for Razor macros

This commit is contained in:
Stephan
2013-09-28 17:23:34 +02:00
parent ea82e9c67e
commit e7754213f1
9 changed files with 229 additions and 127 deletions

View File

@@ -95,13 +95,20 @@ namespace Umbraco.Web.Routing
// can't go beyond that point without a PublishedContent to render
// it's ok not to have a template, in order to give MVC a chance to hijack routes
// assign the legacy page back to the docrequest
// handlers like default.aspx will want it and most macros currently need it
_pcr.UmbracoPage = new page(_pcr);
// note - the page() ctor below will cause the "page" to get the value of all its
// "elements" ie of all the IPublishedContent property. If we use the object value,
// that will trigger macro execution - which can't happen because macro execution
// requires that _pcr.UmbracoPage is already initialized = catch-22. The "legacy"
// pipeline did _not_ evaluate the macros, ie it is using the data value, and we
// have to keep doing it because of that catch-22.
// these two are used by many legacy objects
_routingContext.UmbracoContext.HttpContext.Items["pageID"] = _pcr.PublishedContent.Id;
_routingContext.UmbracoContext.HttpContext.Items["pageElements"] = _pcr.UmbracoPage.Elements;
// assign the legacy page back to the docrequest
// handlers like default.aspx will want it and most macros currently need it
_pcr.UmbracoPage = new page(_pcr);
// used by many legacy objects
_routingContext.UmbracoContext.HttpContext.Items["pageID"] = _pcr.PublishedContent.Id;
_routingContext.UmbracoContext.HttpContext.Items["pageElements"] = _pcr.UmbracoPage.Elements;
}
/// <summary>
@@ -138,6 +145,8 @@ namespace Umbraco.Web.Routing
return;
}
// see note in PrepareRequest()
// assign the legacy page back to the docrequest
// handlers like default.aspx will want it and most macros currently need it
_pcr.UmbracoPage = new page(_pcr);