You are here

public function EnrollActionForm::getGroups in Open Social 10.2.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::getGroups()
  2. 8 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::getGroups()
  3. 8.2 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::getGroups()
  4. 8.3 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::getGroups()
  5. 8.4 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::getGroups()
  6. 8.5 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::getGroups()
  7. 8.6 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::getGroups()
  8. 8.7 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::getGroups()
  9. 8.8 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::getGroups()
  10. 10.3.x modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::getGroups()
  11. 10.0.x modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::getGroups()
  12. 10.1.x modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::getGroups()

Get group object where event enrollment is posted in.

Returns an array of Group Objects.

Return value

array Array of group entities.

1 call to EnrollActionForm::getGroups()
EnrollActionForm::buildForm in modules/social_features/social_event/src/Form/EnrollActionForm.php
Form constructor.

File

modules/social_features/social_event/src/Form/EnrollActionForm.php, line 505

Class

EnrollActionForm
Class EnrollActionForm.

Namespace

Drupal\social_event\Form

Code

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;
}