Rock.Web.UI.Controls.PersonProfileBadgeList.CreateChildControls C# (CSharp) Method

CreateChildControls() protected method

Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
protected CreateChildControls ( ) : void
return void
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            Controls.Clear();

            _badges.Clear();
            if ( PersonBadges != null )
            {
                var currentPerson =  ((RockPage)Page).CurrentPerson;
                foreach ( var personBadge in PersonBadges.OrderBy( b => b.Order ) )
                {
                    if ( personBadge.IsAuthorized( Authorization.VIEW, currentPerson ) )
                    {
                        var badgeControl = new PersonProfileBadge();
                        badgeControl.PersonBadge = personBadge;
                        _badges.Add( badgeControl );
                        Controls.Add( badgeControl );
                    }
                }
            }
        }