You are here

function farm_api_modules_enabled in farmOS 7

Implements hook_modules_enabled().

File

modules/farm/farm_api/farm_api.module, line 243
Farm API module.

Code

function farm_api_modules_enabled($modules) {

  // If the modules provide OAuth2 clients, enable them.
  $hook = 'farm_api_oauth2_client';
  foreach ($modules as $module) {
    $function = $module . '_' . $hook;
    if (function_exists($function)) {
      $clients = $function();
      foreach ($clients as $client) {
        $label = !empty($client['label']) ? $client['label'] : '';
        $client_key = !empty($client['client_key']) ? $client['client_key'] : '';
        $client_secret = !empty($client['client_secret']) ? $client['client_secret'] : '';
        $redirect_uri = !empty($client['redirect_uri']) ? $client['redirect_uri'] : '';
        $settings = !empty($client['settings']) ? $client['settings'] : array();
        if (!empty($label) && !empty($client_key)) {
          farm_api_enable_oauth_client($label, $client_key, $client_secret, $redirect_uri, $settings);
        }
      }
    }
  }
}