You are here

public function SocialCoreController::myInvitesUserPage in Open Social 10.3.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_core/src/Controller/SocialCoreController.php \Drupal\social_core\Controller\SocialCoreController::myInvitesUserPage()
  2. 10.0.x modules/social_features/social_core/src/Controller/SocialCoreController.php \Drupal\social_core\Controller\SocialCoreController::myInvitesUserPage()
  3. 10.1.x modules/social_features/social_core/src/Controller/SocialCoreController.php \Drupal\social_core\Controller\SocialCoreController::myInvitesUserPage()
  4. 10.2.x modules/social_features/social_core/src/Controller/SocialCoreController.php \Drupal\social_core\Controller\SocialCoreController::myInvitesUserPage()

Redirects a user to the group or events invite page, or home if empty.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse Returns a redirect to the events of the currently logged in user.

1 string reference to 'SocialCoreController::myInvitesUserPage'
social_core.routing.yml in modules/social_features/social_core/social_core.routing.yml
modules/social_features/social_core/social_core.routing.yml

File

modules/social_features/social_core/src/Controller/SocialCoreController.php, line 183

Class

SocialCoreController
Returns responses for social_core module routes.

Namespace

Drupal\social_core\Controller

Code

public function myInvitesUserPage() {

  /** @var \Drupal\social_core\InviteService $core_invites */
  $core_invites = \Drupal::service('social_core.invite');

  // Only when there are actual Invite plugins enabled.
  if (!empty($core_invites
    ->getInviteData('name'))) {
    return $this
      ->redirect($core_invites
      ->getInviteData('name'), [
      'user' => $this
        ->currentUser()
        ->id(),
    ]);
  }

  // If there are no invites found or no module enabled
  // lets redirect user to their stream.
  return $this
    ->redirect('social_user.user_home', [
    'user' => $this
      ->currentUser()
      ->id(),
  ]);
}