function oauth2_client_load in OAuth2 Client 8
Same name in this branch
- 8 oauth2_client.module \oauth2_client_load()
- 8 oauth2_client.api.php \oauth2_client_load()
Same name and namespace in other branches
- 7.2 oauth2_client.module \oauth2_client_load()
- 7.2 oauth2_client.api.php \oauth2_client_load()
- 7 oauth2_client.module \oauth2_client_load()
Load an oauth2 client.
Parameters
string $name: Name of the client.
Return value
\Drupal\oauth2_client\Service\OAuth2Client Returns an OAuth2Client object
Throws
\Exception
1 call to oauth2_client_load()
- TestController::callback in tests/
oauth2_client_test/ src/ Controller/ TestController.php - Trying test clients.
File
- ./
oauth2_client.module, line 43 - Provides OAuth2 client functionality.
Code
function oauth2_client_load($name) {
$oauth2_clients = oauth2_client_get_all();
if (!isset($oauth2_clients[$name])) {
throw new Exception(t('The client %name has not been defined.', [
'%name' => $name,
]));
}
$oauth2_client = \Drupal::service('oauth2.client');
$oauth2_client
->init($oauth2_clients[$name], $name);
return $oauth2_client;
}