/// <summary> /// Shows the settings. /// </summary> protected override void ShowSettings() { mdCategoryTreeConfig.Visible = true; var entityType = EntityTypeCache.Read( this.GetAttributeValue( "EntityType" ).AsGuid() ); var rootCategory = new CategoryService( new RockContext() ).Get( this.GetAttributeValue( "RootCategory" ).AsGuid() ); cpRootCategory.EntityTypeId = entityType != null ? entityType.Id : 0; // make sure the rootCategory matches the EntityTypeId (just in case they changed the EntityType after setting RootCategory if ( rootCategory != null && cpRootCategory.EntityTypeId == rootCategory.EntityTypeId ) { cpRootCategory.SetValue( rootCategory ); } else { cpRootCategory.SetValue( null ); } cpRootCategory.Enabled = entityType != null; nbRootCategoryEntityTypeWarning.Visible = entityType == null; var excludedCategories = new CategoryService( new RockContext() ).GetByGuids( this.GetAttributeValue( "ExcludeCategories" ).SplitDelimitedValues().AsGuidList() ); cpExcludeCategories.EntityTypeId = entityType != null ? entityType.Id : 0; // make sure the excluded categories matches the EntityTypeId (just in case they changed the EntityType after setting excluded categories if ( excludedCategories != null && excludedCategories.All( a => a.EntityTypeId == cpExcludeCategories.EntityTypeId) ) { cpExcludeCategories.SetValues( excludedCategories ); } else { cpExcludeCategories.SetValue( null ); } mdCategoryTreeConfig.Show(); }