You are here

public function GroupMembership::getRoles in Group 8

Same name and namespace in other branches
  1. 2.0.x src/GroupMembership.php \Drupal\group\GroupMembership::getRoles()

Returns the group roles for the membership.

Return value

\Drupal\group\Entity\GroupRoleInterface[] An array of group roles, keyed by their ID.

File

src/GroupMembership.php, line 75

Class

GroupMembership
Wrapper class for a GroupContent entity representing a membership.

Namespace

Drupal\group

Code

public function getRoles() {

  /** @var \Drupal\group\Entity\Storage\GroupRoleStorageInterface $group_role_storage */
  $group_role_storage = \Drupal::entityTypeManager()
    ->getStorage('group_role');
  return $group_role_storage
    ->loadByUserAndGroup($this
    ->getUser(), $this
    ->getGroup());
}