You are here

public function MembersPlugin::getGroupMembersIds in Opigno Learning path 8

Returns group members uids.

Parameters

\Drupal\group\Entity\Group $group: Group object.

Return value

array|null Array of members uids if exist, null otherwise.

Overrides LearningPathMembersPluginBase::getGroupMembersIds

File

src/Plugin/LearningPathMembers/MembersPlugin.php, line 242

Class

MembersPlugin
Class MembersPlugin.

Namespace

Drupal\opigno_learning_path\Plugin\LearningPathMembers

Code

public function getGroupMembersIds(Group $group) {
  if ($group_members = $group
    ->getMembers()) {
    $group_members = array_map(function ($member) {

      /** @var \Drupal\group\GroupMembership $member */
      $user = $member
        ->getUser();
      return $user
        ->id();
    }, $group_members);
    if ($group_members) {
      return $group_members;
    }
  }
  return NULL;
}