Web.UmbracoHelper - add ContentAtRoot, MediaAtRoot methods
This commit is contained in:
@@ -480,6 +480,11 @@ namespace Umbraco.Web
|
||||
return TypedContent(ids.ToArray());
|
||||
}
|
||||
|
||||
public IEnumerable<IPublishedContent> TypedContentsAtRoot()
|
||||
{
|
||||
return TypedDocumentsAtRoot(PublishedContentStoreResolver.Current.PublishedContentStore);
|
||||
}
|
||||
|
||||
public dynamic Content(object id)
|
||||
{
|
||||
return DocumentById(id, PublishedContentStoreResolver.Current.PublishedContentStore, new DynamicNull());
|
||||
@@ -525,6 +530,11 @@ namespace Umbraco.Web
|
||||
return Content(ids.ToArray());
|
||||
}
|
||||
|
||||
public dynamic ContentAtRoot()
|
||||
{
|
||||
return DocumentsAtRoot(PublishedContentStoreResolver.Current.PublishedContentStore);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Media
|
||||
@@ -584,6 +594,11 @@ namespace Umbraco.Web
|
||||
return TypedMedia(ids.ToArray());
|
||||
}
|
||||
|
||||
public IEnumerable<IPublishedContent> TypedMediasAtRoot()
|
||||
{
|
||||
return TypedDocumentsAtRoot(PublishedMediaStoreResolver.Current.PublishedMediaStore);
|
||||
}
|
||||
|
||||
public dynamic Media(object id)
|
||||
{
|
||||
return DocumentById(id, PublishedMediaStoreResolver.Current.PublishedMediaStore, new DynamicNull());
|
||||
@@ -629,6 +644,11 @@ namespace Umbraco.Web
|
||||
return Media(ids.ToArray());
|
||||
}
|
||||
|
||||
public dynamic MediaAtRoot()
|
||||
{
|
||||
return DocumentsAtRoot(PublishedMediaStoreResolver.Current.PublishedMediaStore);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Used by Content/Media
|
||||
@@ -693,6 +713,11 @@ namespace Umbraco.Web
|
||||
return ids.Select(eachId => TypedDocumentById(eachId, store));
|
||||
}
|
||||
|
||||
private IEnumerable<IPublishedContent> TypedDocumentsAtRoot(IPublishedStore store)
|
||||
{
|
||||
return store.GetRootDocuments(_umbracoContext);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overloaded method accepting an 'object' type
|
||||
/// </summary>
|
||||
@@ -730,6 +755,14 @@ namespace Umbraco.Web
|
||||
: ifNotFound;
|
||||
}
|
||||
|
||||
private dynamic DocumentsAtRoot(IPublishedStore store)
|
||||
{
|
||||
return new DynamicPublishedContentList(
|
||||
store.GetRootDocuments(_umbracoContext)
|
||||
.Select(publishedContent => new DynamicPublishedContent(publishedContent))
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overloaded method accepting an 'object' type
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user