public static void SetTranslation(this IContentList <DetailCollection> collections, string key, string value, string collectionKey = DefaultCollectionKey) { if (string.IsNullOrEmpty(key)) { return; } var collection = collections[collectionKey]; var detail = collection.Details.Where(cd => cd.Meta == key).FirstOrDefault(); if (detail == null) { if (value == null) { return; } detail = new ContentDetail(collection.EnclosingItem, collection.Name, value) { Meta = key }; detail.AddTo(collection); } else if (value == null) { collection.Details.Remove(detail); } else { detail.StringValue = value; } }
public static IDictionary <string, string> GetTranslations(this IContentList <DetailCollection> collections, string collectionKey = DefaultCollectionKey) { var collection = collections[collectionKey]; if (collection == null || collection.Details == null) { return(new Dictionary <string, string>()); } return(collections[collectionKey].Details .Where(cd => !string.IsNullOrEmpty(cd.Meta)) .ToDictionary(cd => cd.Meta, cd => cd.StringValue)); }
public static ItemList <T> WhereAccessible <T>(this IContentList <T> items, IPrincipal byUser = null, ISecurityManager security = null) where T : ContentItem { return(new ItemList <T>(items, new AccessFilter(byUser, security))); }
public static string GetTranslation(this IContentList <DetailCollection> collections, string key, string collectionKey = DefaultCollectionKey) { return(collections[collectionKey].Details.Where(cd => cd.Meta == key).Select(cd => cd.StringValue).FirstOrDefault()); }
public static ItemList <T> WhereNavigatable <T>(this IContentList <T> items, System.Security.Principal.IPrincipal byUser = null, N2.Security.ISecurityManager security = null) where T : ContentItem { return(new ItemList <T>(items, new NavigationFilter(byUser, security))); }