You are here

function oauth2_client_get_all in OAuth2 Client 8

Same name and namespace in other branches
  1. 7.2 oauth2_client.module \oauth2_client_get_all()
  2. 7 oauth2_client.module \oauth2_client_get_all()

Gets all defined oauth2_clients.

1 call to oauth2_client_get_all()
oauth2_client_load in ./oauth2_client.module
Load an oauth2 client.

File

./oauth2_client.module, line 14
Provides OAuth2 client functionality.

Code

function oauth2_client_get_all() {
  $data = [];
  $module_handler = \Drupal::moduleHandler();
  foreach ($module_handler
    ->getImplementations('oauth2_clients') as $module) {
    $result = call_user_func($module . '_oauth2_clients');
    if (isset($result) && is_array($result)) {
      foreach ($result as $name => $item) {
        $item += [
          'module' => $module,
        ];
        $data[$name] = $item;
      }
    }
  }
  \Drupal::moduleHandler()
    ->alter('oauth2_clients', $data);
  return $data;
}