Quantcast
Channel: Using Optimizely Platforms
Viewing all articles
Browse latest Browse all 8020

How to get the current page from the SelectionFactory that using in block

$
0
0

I have a page type that store some options, and I want to use them in a property (SelectOne) of a block type. When create a block, that property will get options from parent page (get in SelectionFactory). I tried to get current page by IPageRouteHelper but always return the HomePage

        public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
        {
            var currentContent = metadata.FindOwnerContent();
            var currentPage = currentContent;
            if (currentContent is BlockData)
            {
                currentPage = _pageRouteHelper.Service.Page;
            }
            return GetColorOptions(currentPage);
        }

Thanks for your help.


Viewing all articles
Browse latest Browse all 8020

Trending Articles