コード例 #1
0
        public void SetsNavigationRootAsHomeItem()
        {
            var item          = _db.GetItem("/sitecore/content/Home/Child1");
            var linkManager   = new Mock <BaseLinkManager>();
            var headerBuilder = new HeaderBuilder(linkManager.Object, _rootResolver);

            var header = headerBuilder.GetHeader(item);

            var expectedItem = _rootResolver.GetNavigationRoot(item);

            Assert.Equal(expectedItem, header.HomeItem);
        }
コード例 #2
0
        public override object ResolveContents(Rendering rendering, IRenderingConfiguration renderingConfig)
        {
            var root = RootResolver.GetNavigationRoot(this.GetContextItem(rendering, renderingConfig));

            return(new
            {
                FooterText = root[Templates.NavigationRoot.Fields.FooterCopyright]
            });
        }
コード例 #3
0
        public Header GetHeader(Item contextItem)
        {
            Debug.Assert(contextItem != null);
            var navigationRoot = RootResolver.GetNavigationRoot(contextItem);

            if (navigationRoot == null)
            {
                return(new Header());
            }

            return(new Header
            {
                HomeItem = navigationRoot,
                HomeUrl = LinkManager.GetItemUrl(navigationRoot),
                NavigationItems = GetNavigationItems(navigationRoot, contextItem)
            });
        }
コード例 #4
0
        public ActionResult Footer()
        {
            var root = RootResolver.GetNavigationRoot(RenderingContext.Current.ContextItem);

            return(View(root));
        }