mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-11-28 17:32:44 +08:00
Fixing WidgetAlternatesFactory to check for a content item in ContentPart too
--HG-- branch : 1.x
This commit is contained in:
@@ -10,7 +10,17 @@ namespace Orchard.DesignerTools.Services {
|
||||
context.ShapeMetadata.OnDisplaying(displayedContext => {
|
||||
// We don't want the "Widget" content item itself, but the content item that consists of the Widget part (e.g. Parts.Blogs.RecentBlogPosts)
|
||||
if (displayedContext.ShapeMetadata.Type != "Widget") {
|
||||
// look for ContentItem property
|
||||
ContentItem contentItem = displayedContext.Shape.ContentItem;
|
||||
|
||||
// if not, check for ContentPart
|
||||
if (contentItem == null) {
|
||||
ContentPart contentPart = displayedContext.Shape.ContentPart;
|
||||
if (contentPart != null) {
|
||||
contentItem = contentPart.ContentItem;
|
||||
}
|
||||
}
|
||||
|
||||
if (contentItem != null) {
|
||||
// Is the contentItem a widget? (we could probably test for the stereotype setting, don't know if that is more efficient than selecting the WidgetPart)
|
||||
var widgetPart = contentItem.As<WidgetPart>();
|
||||
|
||||
Reference in New Issue
Block a user