public static function roleLabel($role = null)
    {
        switch ($role) {
            case User::ROLE_ADMIN:
                $label = 'danger';
                $name = ArrayHelper::getValue(User::getRoles(), $role);
                break;
            case User::ROLE_MODERATOR:
                $label = 'info';
                $name = ArrayHelper::getValue(User::getRoles(), $role);
                break;
            default:
                $label = 'warning';
                $name = ArrayHelper::getValue(User::getRoles(), User::ROLE_MEMBER);
        }

        return Html::tag('span', $name, ['class' => 'label label-' . $label]);
    }
public static function roleLabel($role = null)
    {
        switch ($role) {
            case User::ROLE_ADMIN:
                $label = 'danger';
                $name = ArrayHelper::getValue(User::getRoles(), $role);
                break;
            case User::ROLE_MODERATOR:
                $label = 'info';
                $name = ArrayHelper::getValue(User::getRoles(), $role);
                break;
            default:
                $label = 'warning';
                $name = ArrayHelper::getValue(User::getRoles(), User::ROLE_MEMBER);
        }

        return Html::tag('span', $name, ['class' => 'label label-' . $label]);
    }
public static function roleLabel ( $ role = null ) { switch ( $ role ) { case User :: ROLE_ADMIN : $ label = 'danger' ; $ name = ArrayHelper :: getValue ( User :: getRoles ( ) , $ role ) ; break ; case User :: ROLE_MODERATOR : $ label = 'info' ; $ name = ArrayHelper :: getValue ( User :: getRoles ( ) , $ role ) ; break ; default : $ label = 'warning' ; $ name = ArrayHelper :: getValue ( User :: getRoles ( ) , User :: ROLE_MEMBER ) ; } return Html :: tag ( 'span' , $ name , [ 'class' => 'label label-' . $ label ] ) ; }
Returns role label HTML.
@param int|null $role role ID
@return string
Returns role label HTML .