Added NodeCount property to ITag/Tag and an optional flag to tag retrieval methods on TagsService, in order to retrieve the count for the tag as well as it's text
This commit is contained in:
@@ -32,40 +32,42 @@ namespace Umbraco.Core.Services
|
||||
/// <summary>
|
||||
/// Get all tags for content items (with optional group)
|
||||
/// </summary>
|
||||
/// <param name="group"></param>
|
||||
/// <param name="group">Optional group</param>
|
||||
/// <param name="withCount">Optional flag to return the number of content items tagged with the tag</param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<ITag> GetAllContentTags(string group = null);
|
||||
IEnumerable<ITag> GetAllContentTags(string group = null, bool withCount = false);
|
||||
|
||||
/// <summary>
|
||||
/// Get all tags for media items (with optional group)
|
||||
/// </summary>
|
||||
/// <param name="group"></param>
|
||||
/// <param name="group">Optional group</param>
|
||||
/// <param name="withCount">Optional flag to return the number of content items tagged with the tag</param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<ITag> GetAllMediaTags(string group = null);
|
||||
IEnumerable<ITag> GetAllMediaTags(string group = null, bool withCount = false);
|
||||
|
||||
/// <summary>
|
||||
/// Get all tags for member items (with optional group)
|
||||
/// </summary>
|
||||
/// <param name="group"></param>
|
||||
/// <param name="group">Optional group</param>
|
||||
/// <param name="withCount">Optional flag to return the number of content items tagged with the tag</param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<ITag> GetAllMemberTags(string group = null);
|
||||
IEnumerable<ITag> GetAllMemberTags(string group = null, bool withCount = false);
|
||||
|
||||
/// <summary>
|
||||
/// Returns all tags attached to a property by entity id
|
||||
/// </summary>
|
||||
/// <param name="contentId"></param>
|
||||
/// <param name="propertyTypeAlias"></param>
|
||||
/// <param name="tagGroup"></param>
|
||||
/// <param name="contentId">The content item id to get tags for</param>
|
||||
/// <param name="propertyTypeAlias">Property type alias</param>
|
||||
/// <param name="tagGroup">Optional tag group</param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<ITag> GetTagsForProperty(int contentId, string propertyTypeAlias, string tagGroup = null);
|
||||
|
||||
/// <summary>
|
||||
/// Returns all tags attached to an entity (content, media or member) by entity id
|
||||
/// </summary>
|
||||
/// <param name="contentId"></param>
|
||||
/// <param name="tagGroup"></param>
|
||||
/// <param name="contentId">The content item id to get tags for</param>
|
||||
/// <param name="tagGroup">Optional tag group</param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<ITag> GetTagsForEntity(int contentId, string tagGroup = null);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ using Umbraco.Core.Persistence.UnitOfWork;
|
||||
namespace Umbraco.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Tag service to query for tags in the tags db table. The tags returned are only relavent for published content & saved media or members
|
||||
/// Tag service to query for tags in the tags db table. The tags returned are only relevant for published content & saved media or members
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If there is unpublished content with tags, those tags will not be contained
|
||||
@@ -110,48 +110,51 @@ namespace Umbraco.Core.Services
|
||||
/// <summary>
|
||||
/// Get all tags for content items (with optional group)
|
||||
/// </summary>
|
||||
/// <param name="group"></param>
|
||||
/// <param name="group">Optional group</param>
|
||||
/// <param name="withCount">Optional flag to return the number of content items tagged with the tag</param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<ITag> GetAllContentTags(string group = null)
|
||||
public IEnumerable<ITag> GetAllContentTags(string group = null, bool withCount = false)
|
||||
{
|
||||
using (var repository = _repositoryFactory.CreateTagsRepository(_uowProvider.GetUnitOfWork()))
|
||||
{
|
||||
return repository.GetTagsForEntityType(TaggableObjectTypes.Content, group);
|
||||
return repository.GetTagsForEntityType(TaggableObjectTypes.Content, group, withCount);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all tags for media items (with optional group)
|
||||
/// </summary>
|
||||
/// <param name="group"></param>
|
||||
/// <param name="group">Optional group</param>
|
||||
/// <param name="withCount">Optional flag to return the number of content items tagged with the tag</param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<ITag> GetAllMediaTags(string group = null)
|
||||
public IEnumerable<ITag> GetAllMediaTags(string group = null, bool withCount = false)
|
||||
{
|
||||
using (var repository = _repositoryFactory.CreateTagsRepository(_uowProvider.GetUnitOfWork()))
|
||||
{
|
||||
return repository.GetTagsForEntityType(TaggableObjectTypes.Media, group);
|
||||
return repository.GetTagsForEntityType(TaggableObjectTypes.Media, group, withCount);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all tags for member items (with optional group)
|
||||
/// </summary>
|
||||
/// <param name="group"></param>
|
||||
/// <param name="group">Optional group</param>
|
||||
/// <param name="withCount">Optional flag to return the number of content items tagged with the tag</param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<ITag> GetAllMemberTags(string group = null)
|
||||
public IEnumerable<ITag> GetAllMemberTags(string group = null, bool withCount = false)
|
||||
{
|
||||
using (var repository = _repositoryFactory.CreateTagsRepository(_uowProvider.GetUnitOfWork()))
|
||||
{
|
||||
return repository.GetTagsForEntityType(TaggableObjectTypes.Member, group);
|
||||
return repository.GetTagsForEntityType(TaggableObjectTypes.Member, group, withCount);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all tags attached to a property by entity id
|
||||
/// </summary>
|
||||
/// <param name="contentId"></param>
|
||||
/// <param name="propertyTypeAlias"></param>
|
||||
/// <param name="tagGroup"></param>
|
||||
/// <param name="contentId">The content item id to get tags for</param>
|
||||
/// <param name="propertyTypeAlias">Property type alias</param>
|
||||
/// <param name="tagGroup">Optional tag group</param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<ITag> GetTagsForProperty(int contentId, string propertyTypeAlias, string tagGroup = null)
|
||||
{
|
||||
@@ -164,8 +167,8 @@ namespace Umbraco.Core.Services
|
||||
/// <summary>
|
||||
/// Returns all tags attached to an entity (content, media or member) by entity id
|
||||
/// </summary>
|
||||
/// <param name="contentId"></param>
|
||||
/// <param name="tagGroup"></param>
|
||||
/// <param name="contentId">The content item id to get tags for</param>
|
||||
/// <param name="tagGroup">Optional tag group</param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<ITag> GetTagsForEntity(int contentId, string tagGroup = null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user