Sdl.Web.Tridion/Providers/Navigation/CILImpl/DynamicNavigationProvider.cs
/// <summary>
/// Gets a Navigation subtree for the given Sitemap Item.
/// </summary>
/// <param name="sitemapItemId">The context <see cref="SitemapItem"/> identifier. Can be <c>null</c>.</param>
/// <param name="filter">The <see cref="NavigationFilter"/> used to specify which information to put in the subtree.</param>
/// <param name="localization">The context <see cref="ILocalization"/>.</param>
/// <returns>A set of Sitemap Items representing the requested subtree.</returns>
Gets a Navigation subtree for the given Sitemap Item.
Gets a Navigation subtree for the given Sitemap Item .
public virtual IEnumerable<SitemapItem> GetNavigationSubtree(string sitemapItemId, NavigationFilter filter, ILocalization localization)
        {
            using (new Tracer(sitemapItemId, filter, localization))
            {
                if (string.IsNullOrEmpty(sitemapItemId))
                {
                    return ExpandTaxonomyRoots(filter, localization);
                }
                string taxonomyId;
                string keywordId;
                string pageId;
                ParseSitemapItemId(sitemapItemId, out taxonomyId, out keywordId, out pageId);
                string taxonomyUri = localization.GetCmUri(taxonomyId, (int) ItemType.Category);
                string keywordUri = string.IsNullOrEmpty(keywordId) ?  taxonomyUri : localization.GetCmUri(keywordId, (int) ItemType.Keyword);
                string pageUri = localization.GetCmUri(pageId, (int) ItemType.Page);
                IEnumerable<SitemapItem> result = new SitemapItem[0];
                if (filter.IncludeAncestors)
                {
                    TaxonomyNode taxonomyRoot = null;
                    if (!string.IsNullOrEmpty(keywordId))
                    {
                        taxonomyRoot = ExpandAncestorsForKeyword(keywordUri, taxonomyUri, filter, localization);
                    }
                    else if (!string.IsNullOrEmpty(pageId))
                    {
                        taxonomyRoot = ExpandAncestorsForPage(pageUri, taxonomyUri, filter, localization);
                    }
                    if (taxonomyRoot != null)
                    {
                        if (filter.DescendantLevels != 0)
                        {
                            AddDescendants(taxonomyRoot, filter, localization);
                        }
                        result = new[] { taxonomyRoot };
                    }
                }
                else if (filter.DescendantLevels != 0 && string.IsNullOrEmpty(pageId))
                {
                    result = ExpandDescendants(keywordUri, taxonomyUri, filter, localization);
                }
                return result;
            }
        }
public virtual IEnumerable < SitemapItem > GetNavigationSubtree ( string sitemapItemId , NavigationFilter filter , ILocalization localization ) { using ( new Tracer ( sitemapItemId , filter , localization ) ) { if ( string . IsNullOrEmpty ( sitemapItemId ) ) { return ExpandTaxonomyRoots ( filter , localization ) ; } string taxonomyId ; string keywordId ; string pageId ; ParseSitemapItemId ( sitemapItemId , out taxonomyId , out keywordId , out pageId ) ; string taxonomyUri = localization . GetCmUri ( taxonomyId , ( int ) ItemType . Category ) ; string keywordUri = string . IsNullOrEmpty ( keywordId ) ? taxonomyUri : localization . GetCmUri ( keywordId , ( int ) ItemType . Keyword ) ; string pageUri = localization . GetCmUri ( pageId , ( int ) ItemType . Page ) ; IEnumerable < SitemapItem > result = new SitemapItem [ 0 ] ; if ( filter . IncludeAncestors ) { TaxonomyNode taxonomyRoot = null ; if ( ! string . IsNullOrEmpty ( keywordId ) ) { taxonomyRoot = ExpandAncestorsForKeyword ( keywordUri , taxonomyUri , filter , localization ) ; } else if ( ! string . IsNullOrEmpty ( pageId ) ) { taxonomyRoot = ExpandAncestorsForPage ( pageUri , taxonomyUri , filter , localization ) ; } if ( taxonomyRoot != null ) { if ( filter . DescendantLevels != 0 ) { AddDescendants ( taxonomyRoot , filter , localization ) ; } result = new [ ] { taxonomyRoot } ; } } else if ( filter . DescendantLevels != 0 && string . IsNullOrEmpty ( pageId ) ) { result = ExpandDescendants ( keywordUri , taxonomyUri , filter , localization ) ; } return result ; } }
Gets a Navigation subtree for the given Sitemap Item.
Gets a Navigation subtree for the given Sitemap Item .
// Extract Taxonomy TCM UI, Keyword TCM URI and/or Page TCM URI from the Sitemap Item ID
A set of Sitemap Items representing the requested subtree.
A set of Sitemap Items representing the requested subtree .
sitemapItemId
string
The context  identifier. Can be null
The context identifier . Can be null
filter
NavigationFilter
The  used to specify which information to put in the subtree.
The used to specify which information to put in the subtree .
localization
ILocalization
The context .
The context .