Sdl.Web.Tridion/Providers/Navigation/CILImpl/DynamicNavigationProvider.cs
/// <summary>
/// Gets Navigation Links for the breadcrumb trail for the given request URL path.
/// </summary>
/// <param name="requestUrlPath">The request URL path.</param>
/// <param name="localization">The Localization.</param>
/// <returns>The Navigation Links.</returns>
Gets Navigation Links for the breadcrumb trail for the given request URL path.
Gets Navigation Links for the breadcrumb trail for the given request URL path .
public virtual NavigationLinks GetBreadcrumbNavigationLinks(string requestUrlPath, ILocalization localization)
        {
            using (new Tracer(requestUrlPath, localization))
            {
                SitemapItem navModel = GetNavigationModel(localization);
                if (!(navModel is TaxonomyNode))
                {
                    return _fallbackNavigationProvider.GetBreadcrumbNavigationLinks(requestUrlPath, localization);
                }
                SitemapItem sitemapItem = navModel.FindSitemapItem(requestUrlPath.NormalizePageUrlPath());
                List<Link> breadcrumb = new List<Link>();
                if (sitemapItem != null)
                {
                    bool hasHome = false;
                    while (sitemapItem.Parent != null)
                    {
                        breadcrumb.Insert(0, sitemapItem.CreateLink(localization));
                        hasHome = IsHome(sitemapItem, localization);
                        sitemapItem = sitemapItem.Parent;
                    }
                    if (!hasHome)
                    {
                        SitemapItem home = sitemapItem.Items.FirstOrDefault(i => IsHome(i, localization));
                        if (home != null)
                        {
                            breadcrumb.Insert(0, home.CreateLink(localization));
                        }
                    }
                }
                return new NavigationLinks
                {
                    Items = breadcrumb
                };
            }
        }
public virtual NavigationLinks GetBreadcrumbNavigationLinks ( string requestUrlPath , ILocalization localization ) { using ( new Tracer ( requestUrlPath , localization ) ) { SitemapItem navModel = GetNavigationModel ( localization ) ; if ( ! ( navModel is TaxonomyNode ) ) { return _fallbackNavigationProvider . GetBreadcrumbNavigationLinks ( requestUrlPath , localization ) ; } SitemapItem sitemapItem = navModel . FindSitemapItem ( requestUrlPath . NormalizePageUrlPath ( ) ) ; List < Link > breadcrumb = new List < Link > ( ) ; if ( sitemapItem != null ) { bool hasHome = false ; while ( sitemapItem . Parent != null ) { breadcrumb . Insert ( 0 , sitemapItem . CreateLink ( localization ) ) ; hasHome = IsHome ( sitemapItem , localization ) ; sitemapItem = sitemapItem . Parent ; } if ( ! hasHome ) { SitemapItem home = sitemapItem . Items . FirstOrDefault ( i => IsHome ( i , localization ) ) ; if ( home != null ) { breadcrumb . Insert ( 0 , home . CreateLink ( localization ) ) ; } } } return new NavigationLinks { Items = breadcrumb } ; } }
Gets Navigation Links for the breadcrumb trail for the given request URL path.
Gets Navigation Links for the breadcrumb trail for the given request URL path .
// No Navigation Taxonomy found in this Localization; fallback to the StaticNavigationProvider. // Build a breadcrumb of ancestors, excluding the Taxonomy Root. // The Home TaxonomyNode/Keyword may be a top-level sibling instead of an ancestor
The Navigation Links.
The Navigation Links .
requestUrlPath
string
The request URL path.
The request URL path .
localization
ILocalization
None