diff --git a/src/Umbraco.Web/Models/DynamicPublishedContent.cs b/src/Umbraco.Web/Models/DynamicPublishedContent.cs index e873321d1e..a4a43f7b22 100644 --- a/src/Umbraco.Web/Models/DynamicPublishedContent.cs +++ b/src/Umbraco.Web/Models/DynamicPublishedContent.cs @@ -118,6 +118,86 @@ namespace Umbraco.Web.Models private IEnumerable _ownersCollection; + /// + /// Need to get/set the owner collection when an item is returned from the result set of a query + /// + /// + /// Based on this issue here: http://issues.umbraco.org/issue/U4-1797 + /// + IEnumerable IOwnerCollectionAware.OwnersCollection + { + get + { + var publishedContentBase = PublishedContent as IOwnerCollectionAware; + if (publishedContentBase != null) + { + return publishedContentBase.OwnersCollection; + } + + //if the owners collection is null, we'll default to it's siblings + if (_ownersCollection == null) + { + //get the root docs if parent is null + _ownersCollection = this.Siblings(); + } + return _ownersCollection; + } + set + { + var publishedContentBase = PublishedContent as IOwnerCollectionAware; + if (publishedContentBase != null) + { + publishedContentBase.OwnersCollection = value; + } + else + { + _ownersCollection = value; + } + } + } + + private IEnumerable _ownersCollection; + + /// + /// Need to get/set the owner collection when an item is returned from the result set of a query + /// + /// + /// Based on this issue here: http://issues.umbraco.org/issue/U4-1797 + /// + IEnumerable IOwnerCollectionAware.OwnersCollection + { + get + { + var publishedContentBase = PublishedContent as IOwnerCollectionAware; + if (publishedContentBase != null) + { + return publishedContentBase.OwnersCollection; + } + + //if the owners collection is null, we'll default to it's siblings + if (_ownersCollection == null) + { + //get the root docs if parent is null + _ownersCollection = this.Siblings(); + } + return _ownersCollection; + } + set + { + var publishedContentBase = PublishedContent as IOwnerCollectionAware; + if (publishedContentBase != null) + { + publishedContentBase.OwnersCollection = value; + } + else + { + _ownersCollection = value; + } + } + } + + private IEnumerable _ownersCollection; + /// /// Need to get/set the owner collection when an item is returned from the result set of a query ///