Layouts: Update CreateDescribeContext to query latest content (#7687), fixes #7686

ElementDriver.OnDisplaying ElementDisplayingContext.Content is not being populated properly when the content item is saved, but not yet published. Instead of query the content only for the published version, use the latest version instead.
This commit is contained in:
Brian Roskamp 2019-08-27 05:21:08 -04:00 committed by Benedek Farkas
parent a3602ce7b0
commit 1a7d6c6f62

View File

@ -151,7 +151,7 @@ namespace Orchard.Layouts.Controllers {
if (contentId == null && contentType == null)
return DescribeElementsContext.Empty;
var part = contentId != null && contentId != 0 ? _contentManager.Get<ILayoutAspect>(contentId.Value)
var part = contentId != null && contentId != 0 ? _contentManager.Get<ILayoutAspect>(contentId.Value, VersionOptions.Latest)
?? _contentManager.New<ILayoutAspect>(contentType)
: _contentManager.New<ILayoutAspect>(contentType);
@ -172,4 +172,4 @@ namespace Orchard.Layouts.Controllers {
ModelState.AddModelError(key, errorMessage.Text);
}
}
}
}