mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-26 03:40:56 +08:00
Updates to handling of MasterContentItem (as they are in 1.10.x) Synchronization of CultureNeutral Fields and Parts (based on Cloning) Support for multi-language Blogs (in its own feature in the Blogs module) Support for multi-language Taxonomies (in its own feature in the Taxonomies module)
31 lines
1.0 KiB
C#
31 lines
1.0 KiB
C#
using System;
|
|
using System.Linq;
|
|
using Orchard.ContentManagement;
|
|
using Orchard.Taxonomies.Models;
|
|
using Orchard.Taxonomies.ViewModels;
|
|
|
|
namespace Orchard.Taxonomies.Helpers {
|
|
public static class TermExtensions {
|
|
public static int GetLevels(this TermPart term) {
|
|
return String.IsNullOrEmpty(term.Path) ? 0 : term.Path.Count(c => c == '/') - 1;
|
|
}
|
|
|
|
public static int GetLevels(this TermEntry term) {
|
|
return String.IsNullOrEmpty(term.Path) ? 0 : term.Path.Count(c => c == '/') - 1;
|
|
}
|
|
|
|
public static TermEntry CreateTermEntry(this TermPart term) {
|
|
return new TermEntry {
|
|
Id = term.Id,
|
|
Name = term.Name,
|
|
Selectable = term.Selectable,
|
|
Count = term.Count,
|
|
Path = term.Path,
|
|
Weight = term.Weight,
|
|
IsChecked = false,
|
|
ContentItem = term.ContentItem,
|
|
HasDraft = term.ContentItem.HasDraft()
|
|
};
|
|
}
|
|
}
|
|
} |