Merge pull request #6617 from jtkech/patch-6

Fixes Layout OnIndexing when using a snippet element
This commit is contained in:
Sébastien Ros
2016-03-24 12:55:32 -07:00

View File

@@ -11,7 +11,6 @@ using Orchard.DisplayManagement.Shapes;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Logging; using Orchard.Logging;
using Orchard.Mvc; using Orchard.Mvc;
using Orchard.Mvc.Extensions;
namespace Orchard.DisplayManagement.Implementation { namespace Orchard.DisplayManagement.Implementation {
public class DefaultDisplayManager : IDisplayManager { public class DefaultDisplayManager : IDisplayManager {
@@ -62,7 +61,9 @@ namespace Orchard.DisplayManagement.Implementation {
return CoerceHtmlString(context.Value); return CoerceHtmlString(context.Value);
var workContext = _workContextAccessor.GetContext(); var workContext = _workContextAccessor.GetContext();
var shapeTable = !_httpContextAccessor.Current().IsBackgroundContext() // CurrentTheme is now available in the background, so here we no longer use IsBackgroundContext().
// We only do a null check, so we can render in the background a view that only exists in the theme.
var shapeTable = _httpContextAccessor.Current() != null
? _shapeTableLocator.Value.Lookup(workContext.CurrentTheme.Id) ? _shapeTableLocator.Value.Lookup(workContext.CurrentTheme.Id)
: _shapeTableLocator.Value.Lookup(null); : _shapeTableLocator.Value.Lookup(null);