Engage.Dnn.Publish.Category.CascadeChildDisplayTab C# (CSharp) Method

CascadeChildDisplayTab() public method

Updates the Item.DisplayTabId and ChildDisplayTabId settings of all children of this Category (and their children's children, etc.)
public CascadeChildDisplayTab ( int revisingUser ) : int
revisingUser int The revising user.
return int
        public int CascadeChildDisplayTab(int revisingUser)
        {
            int count = 0;
            foreach (DataRow itemRow in GetAllChildren(this.ItemId, RelationshipType.ItemToParentCategory.GetId(), this.PortalId).Tables[0].Rows)
            {
                Item childItem;
                var itemId = (int)itemRow["itemId"];
                if (GetItemTypeId(itemId) == ItemType.Article.GetId())
                {
                    childItem = Article.GetArticle(itemId, this.PortalId, true, true, true);
                }
                else
                {
                    childItem = GetCategory(itemId, true, true);
                }

                childItem.DisplayTabId = this.ChildDisplayTabId;

                var childCategory = childItem as Category;
                if (childCategory != null)
                {
                    childCategory.ChildDisplayTabId = this.ChildDisplayTabId;
                }

                Setting displayOnCurrentPageSetting = Setting.ArticleSettingCurrentDisplay;
                displayOnCurrentPageSetting.PropertyValue = false.ToString(CultureInfo.InvariantCulture);
                childItem.VersionSettings.Add(new ItemVersionSetting(displayOnCurrentPageSetting));

                childItem.Save(revisingUser);
                count++;
            }

            return count;
        }