authManager->getRolesByUser($model->id); return $roles === [] ? $this->grid->emptyCell : implode(', ', array_map(function (Item $role) { return $this->getRoleLabel($role); }, $roles)); } private function getRoleLabel(Item $role): string { $class = $role->name == Rbac::ROLE_USER ? 'primary' : 'danger'; return Html::tag('span', Html::encode($role->description), ['class' => 'label label-' . $class]); } }