Exemple #1
0
        /// <summary>
        /// A helper method that filters a ChildList for items that support the specified language.  This is 
        /// used in navigation controls or on landing or directory pages, to ignore all items that are not available in the 
        /// current language
        /// </summary>
        /// <param name="item">The set of children to filter</param>
        /// <param name="language">The language for which to filter</param>
        /// <returns>A collection of children that have versions in the current language, or null if none were available</returns>
        public static IEnumerable<Sitecore.Data.Items.Item> FilterChildListByLanguage(Sitecore.Collections.ChildList list, String language)
        {
            if (null != list && null != language)
            {
                var items = list.Where(i => HasLanguageVersion(i, language)).ToList();
                if (null != items && items.Any()) return items;
            }

            return null;
        }