You are here

public function GroupType::getRoles in Group 8

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

Gets the group roles.

Parameters

bool $include_internal: (optional) Whether to include internal roles in the result. Defaults to TRUE.

Return value

\Drupal\group\Entity\GroupRoleInterface[] The group roles this group type uses.

Overrides GroupTypeInterface::getRoles

File

src/Entity/GroupType.php, line 136

Class

GroupType
Defines the Group type configuration entity.

Namespace

Drupal\group\Entity

Code

public function getRoles($include_internal = TRUE) {
  $properties = [
    'group_type' => $this
      ->id(),
  ];

  // Exclude internal roles if told to.
  if ($include_internal === FALSE) {
    $properties['internal'] = FALSE;
  }
  return $this
    ->entityTypeManager()
    ->getStorage('group_role')
    ->loadByProperties($properties);
}