You are here

public function ReportManager::formatFromPath in Forena Reports 8

Determine doucment format from path and extract it if necessary.

Parameters

$report_name:

Return value

string Document type from path.

2 calls to ReportManager::formatFromPath()
ReportManager::report in src/ReportManager.php
Generate a forena report
ReportManager::reportInclude in src/ReportManager.php
Generate a forena report

File

src/ReportManager.php, line 36
Implements \Drupal\forena\File\ReportFileSystem

Class

ReportManager
Access to Report rendering engine.

Namespace

Drupal\forena

Code

public function formatFromPath(&$report_name) {
  $format = 'drupal';
  $parts = explode('.', $report_name);
  if ($parts) {
    $ext = strtolower(array_pop($parts));
    $document_types = DocManager::instance()
      ->getDocTypes();
    if (array_search($ext, $document_types) !== FALSE) {
      $report_name = implode('.', $parts);
      $format = $ext;
    }
  }
  return $format;
}