You are here

public static function LearningPathAccess::getGroupRoles in Opigno Learning path 3.x

Same name and namespace in other branches
  1. 8 src/LearningPathAccess.php \Drupal\opigno_learning_path\LearningPathAccess::getGroupRoles()

Gets group role.

File

src/LearningPathAccess.php, line 27

Class

LearningPathAccess
Class LearningPathAccess.

Namespace

Drupal\opigno_learning_path

Code

public static function getGroupRoles(Group $group) {
  $type = array_shift($group->type
    ->getValue());
  $properties = [
    'group_type' => $type['target_id'],
    'permissions_ui' => TRUE,
  ];
  return \Drupal::entityTypeManager()
    ->getStorage('group_role')
    ->loadByProperties($properties);
}