You are here

public function AppService::getDocumentPlugins in Forena Reports 8

1 method overrides AppService::getDocumentPlugins()
TestingAppService::getDocumentPlugins in tests/src/Unit/Mock/TestingAppService.php

File

src/AppService.php, line 131

Class

AppService

Namespace

Drupal\forena

Code

public function getDocumentPlugins() {
  $type_map = [];
  $pm = \Drupal::service('frxplugin.manager.document');
  $enabled_types = \Drupal::config('forena.settings')
    ->get('doc_formats');
  $plugins = $pm
    ->getDefinitions();
  foreach ($enabled_types as $doc_type) {

    // Find out if plugin is defined.
    if (isset($plugins[$doc_type])) {
      $def = $plugins[$doc_type];
      $ext = $def['ext'];
      $class = $def['class'];
      $type_map[$ext] = $class;
    }
  }
  return $type_map;
}