You are here

public function SimpleFbConnectFbManager::getFbLoginUrl in Simple FB Connect 8.2

Same name and namespace in other branches
  1. 8.3 src/SimpleFbConnectFbManager.php \Drupal\simple_fb_connect\SimpleFbConnectFbManager::getFbLoginUrl()

Returns the Facebook login URL where user will be redirected.

Return value

string Absolute Facebook login URL where user will be redirected

File

src/SimpleFbConnectFbManager.php, line 104
Contains \Drupal\simple_fb_connect\SimpleFbConnectFbManager.

Class

SimpleFbConnectFbManager
Contains all Simple FB Connect logic that is related to Facebook interaction.

Namespace

Drupal\simple_fb_connect

Code

public function getFbLoginUrl() {
  $login_helper = new FacebookRedirectLoginHelper($this->returnUrl);
  $login_helper
    ->disableSessionStatusCheck();

  // Dispatch an event so that other modules can modify the permission scope.
  // Set the scope twice on the event: as the main subject but also in the
  // list of arguments.
  $e = new GenericEvent($this->scope, [
    'scope' => $this->scope,
  ]);
  $event = $this->eventDispatcher
    ->dispatch('simple_fb_connect.scope', $e);
  $final_scope = $event
    ->getArgument('scope');
  return $login_helper
    ->getLoginUrl($final_scope);
}