You are here

function social_group_preprocess_group__hero in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_group/social_group.module \social_group_preprocess_group__hero()
  2. 8.2 modules/social_features/social_group/social_group.module \social_group_preprocess_group__hero()
  3. 8.3 modules/social_features/social_group/social_group.module \social_group_preprocess_group__hero()
  4. 8.4 modules/social_features/social_group/social_group.module \social_group_preprocess_group__hero()
  5. 8.5 modules/social_features/social_group/social_group.module \social_group_preprocess_group__hero()
  6. 8.6 modules/social_features/social_group/social_group.module \social_group_preprocess_group__hero()
  7. 8.7 modules/social_features/social_group/social_group.module \social_group_preprocess_group__hero()
  8. 8.8 modules/social_features/social_group/social_group.module \social_group_preprocess_group__hero()
  9. 10.3.x modules/social_features/social_group/social_group.module \social_group_preprocess_group__hero()
  10. 10.0.x modules/social_features/social_group/social_group.module \social_group_preprocess_group__hero()
  11. 10.1.x modules/social_features/social_group/social_group.module \social_group_preprocess_group__hero()
  12. 10.2.x modules/social_features/social_group/social_group.module \social_group_preprocess_group__hero()

Implements hook_preprocess_HOOK().

File

modules/social_features/social_group/social_group.module, line 295
The Social group module.

Code

function social_group_preprocess_group__hero(array &$variables) {

  /** @var \Drupal\group\Entity\GroupInterface $group */
  $group = $variables['group'];
  $account = \Drupal::currentUser();
  if ($group
    ->bundle() == 'public_group' && $account
    ->isAnonymous()) {
    $variables['group_operations_url'] = Url::fromRoute('user.register', [], [
      'query' => [
        'destination' => Url::fromRoute('entity.group.join', [
          'group' => $group
            ->id(),
        ])
          ->toString(),
      ],
    ])
      ->toString();
  }
}