You are here

public function AppService::getForenaProviders in Forena Reports 8

File

src/AppService.php, line 162

Class

AppService

Namespace

Drupal\forena

Code

public function getForenaProviders() {
  $discovery = new YamlDiscovery('forena', \Drupal::moduleHandler()
    ->getModuleDirectories());
  $providers = $discovery
    ->findAll();
  foreach ($providers as $module_name => $provider) {

    // Adjust Report Directories based on module name
    if (isset($provider['report directory'])) {
      $this
        ->correctModulePath($module_name, $providers[$module_name]['report directory']);
    }
    if (isset($provider['data'])) {
      foreach ($provider['data'] as $data_provider => $definition) {
        $this
          ->correctModulePath($module_name, $providers[$module_name]['data'][$data_provider]['source']);
      }
    }
  }
  \Drupal::moduleHandler()
    ->alter('forena_providers', $providers);
  return $providers;
}