Esempio n. 1
0
        /// <summary>
        /// Gets an item from its ID.
        /// </summary>
        /// <param name="p_Id">The ID of the item.</param>
        /// <param name="p_SourceItemLanguage">The language of the indexed item used to get the item.</param>
        /// <returns>The item in the same language as the indexed item if found, the item in the default language otherwise. <c>null</c> if the item doesn't exist.</returns>
        private IItem ResolveReferencedItem(string p_Id,
                                            Language p_SourceItemLanguage)
        {
            IItem item = s_Database.GetItem(p_Id, p_SourceItemLanguage);

            // When an item does exist but not in the requested language, Sitecore returns an
            // incomplete item. We must then verify if the item
            // has a version to know whether it is a real item or not.
            if (item == null || !item.Versions.HasVersion())
            {
                item = s_Database.GetItem(p_Id);
            }

            return(item);
        }