Esempio n. 1
0
        /// <summary>
        /// Return the valid links in the specified version of the item.
        /// </summary>
        /// <param name="me">The item containing the links.</param>
        /// <returns>The valid links in the specified version of the item.</returns>
        public static Sitecore.Links.ItemLink[] GetVersionLinks(
            this Sitecore.Data.Items.Item me)
        {
            Sitecore.Diagnostics.Assert.IsNotNull(me, "item");
            List <Sitecore.Links.ItemLink> links     = new List <Sitecore.Links.ItemLink>();
            List <Sitecore.Data.ID>        processed = new List <Sitecore.Data.ID>();

            foreach (Sitecore.Links.ItemLink itemLink in me.Links.GetAllLinks())
            {
                if (processed.Contains(itemLink.TargetItemID))
                {
                    continue;
                }

                if (me.IsValidLink(itemLink))
                {
                    links.Add(itemLink);
                }

                processed.Add(itemLink.TargetItemID);
            }

            return(links.ToArray());
        }