Beispiel #1
0
        private void GetBlockItems(BlockData blockData, List <BlockData> blockDatas, PageData currentPage)
        {
            if (blockData == null)
            {
                return;
            }

            var secondLevelBlocks = new List <InternalBlockItem>();

            var secondLevelContentAreaItems = blockData.GetContentAreaItemsForBlock();
            var pageLanguage = new CultureInfo(currentPage.LanguageBranch);

            var listBlock = new List <BlockData>();

            foreach (var item in secondLevelContentAreaItems)
            {
                if (item.ContentLink.IsNullOrEmpty())
                {
                    continue;
                }

                IContent content;

                _contentRepository.TryGet(item.ContentLink, pageLanguage, out content);

                if (content is ElementBlockBase)
                {
                    continue;
                }

                if (content is BlockData)
                {
                    listBlock.Add(content as BlockData);
                }
            }
            var inlineBlocks = blockData.GetInlineBlockForBlock();

            if (inlineBlocks != null && inlineBlocks.Length > 0)
            {
                listBlock.AddRange(inlineBlocks);
            }
            if (listBlock != null && listBlock.Any())
            {
                foreach (var inlineBlock in listBlock)
                {
                    if (CheckBlockIsFormType(inlineBlock))
                    {
                        blockDatas.Add(inlineBlock);
                    }
                    GetBlockItems(inlineBlock as BlockData, blockDatas, currentPage);
                }
            }
        }