You are here

function hybridauth_get_provider_config in HybridAuth Social Login 7.2

Same name and namespace in other branches
  1. 6.2 hybridauth.module \hybridauth_get_provider_config()
  2. 7 hybridauth.auth.inc \hybridauth_get_provider_config()

Returns provider config.

1 call to hybridauth_get_provider_config()
hybridauth_get_config in ./hybridauth.module
Returns HybridAuth config.

File

./hybridauth.module, line 923
Main file for the HybridAuth module.

Code

function hybridauth_get_provider_config($provider_id) {
  $config = array(
    'enabled' => array_key_exists($provider_id, array_filter(variable_get('hybridauth_providers', array()))),
    'keys' => array(
      'id' => trim(variable_get('hybridauth_provider_' . $provider_id . '_keys_id', '')),
      'key' => trim(variable_get('hybridauth_provider_' . $provider_id . '_keys_key', '')),
      'secret' => trim(variable_get('hybridauth_provider_' . $provider_id . '_keys_secret', '')),
    ),
    'scope' => variable_get('hybridauth_provider_' . $provider_id . '_scope', ''),
    'display' => variable_get('hybridauth_provider_' . $provider_id . '_display', ''),
    'hauth_return_to' => url('hybridauth/endpoint', array(
      'absolute' => TRUE,
      'language' => _hybridauth_language_default(),
    )),
  );
  if (is_array($config['scope'])) {
    $config['scope'] = array_filter($config['scope']);
  }
  if ($provider = hybridauth_get_provider($provider_id)) {
    if ($function = ctools_plugin_get_function($provider, 'configuration_callback')) {
      $function($config, $provider_id);
    }
  }

  // Allow other modules to alter the provider config.
  drupal_alter('hybridauth_provider_config', $config, $provider_id);
  return $config;
}