public function getGroups($node) {

    $groupcontents = GroupContent::loadByEntity($node);

    $groups = [];
    // Only react if it is actually posted inside a group.
    if (!empty($groupcontents)) {
      foreach ($groupcontents as $groupcontent) {
        /* @var \Drupal\group\Entity\GroupContent $groupcontent */
        $group = $groupcontent->getGroup();
        /* @var \Drupal\group\Entity\Group $group */
        $groups[] = $group;
      }
    }

    return $groups;
  }
public function getGroups($node) {

    $groupcontents = GroupContent::loadByEntity($node);

    $groups = [];
    // Only react if it is actually posted inside a group.
    if (!empty($groupcontents)) {
      foreach ($groupcontents as $groupcontent) {
        /* @var \Drupal\group\Entity\GroupContent $groupcontent */
        $group = $groupcontent->getGroup();
        /* @var \Drupal\group\Entity\Group $group */
        $groups[] = $group;
      }
    }

    return $groups;
  }
public function getGroups ( $ node ) { $ groupcontents = GroupContent :: loadByEntity ( $ node ) ; $ groups = [ ] ; // Only react if it is actually posted inside a group. if ( ! empty ( $ groupcontents ) ) { foreach ( $ groupcontents as $ groupcontent ) { /* @var \Drupal\group\Entity\GroupContent $groupcontent */ $ group = $ groupcontent -> getGroup ( ) ; /* @var \Drupal\group\Entity\Group $group */ $ groups [ ] = $ group ; } } return $ groups ; }
Get group object where event enrollment is posted in.

Returns an array of Group Objects.

@return array
Array of group entities.
Get group object where event enrollment is posted in .