You are here

public function EnrollActionBlock::getGroups in Open Social 8.2

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

Get group object where event enrollment is posted in.

Returns an array of Group Objects.

Return value

array Group entities.

1 call to EnrollActionBlock::getGroups()
EnrollActionBlock::blockAccess in modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php
Custom access logic to display the block on the hero region for an event.

File

modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php, line 139

Class

EnrollActionBlock
Provides a 'EnrollActionBlock' block.

Namespace

Drupal\social_event\Plugin\Block

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