You are here

function facebook_client in Simple FB Connect 8

Same name and namespace in other branches
  1. 7 simple_fb_connect.module \facebook_client()

Get the facebook client object for easy access.

Return value

Facebook Facebook Api object

1 call to facebook_client()
SimpleFBConnectController::unified_login_register in src/Controller/SimpleFBConnectController.php

File

./simple_fb_connect.module, line 85
Simple Facebook Login Module for Drupal Sites.

Code

function facebook_client() {
  static $fb = NULL;
  if (is_null($fb)) {
    if (simple_fb_connect_facebook_client_load_include()) {

      // Load the configuration.
      $config = \Drupal::config('simple_fb_connect.settings');
      $init_params = array(
        'appId' => $config
          ->get('simple_fb_connect_appid'),
        'secret' => $config
          ->get('simple_fb_connect_skey'),
      );
      $fb = new Facebook($init_params);
    }
  }
  return $fb;
}