You are here

public function AppService::__construct in Forena Reports 8

Return Current site context.

Return value

array

1 method overrides AppService::__construct()
TestingAppService::__construct in tests/src/Unit/Mock/TestingAppService.php
Return Current site context.

File

src/AppService.php, line 188

Class

AppService

Namespace

Drupal\forena

Code

public function __construct() {
  $site = array();
  global $language;
  global $user;
  global $theme_path;
  global $base_root;
  $site['base_path'] = $this->base_path = base_path();
  $site['dir'] = rtrim(base_path(), '/');
  $site['theme_path'] = base_path() . $theme_path;
  $site['theme_dir'] =& $theme_path;
  $site['base_url'] =& $base_root;
  $user = \Drupal::currentUser();
  $site['user_name'] = $user
    ->id() ? $user
    ->getAccountName() : '';
  $site['uid'] = $user
    ->id();
  $site['language'] =& $language;

  //@TODO: Current Page

  //$site['page'] = base_path() . $_GET['q'];
  $dest = drupal_get_destination();
  $site['destination'] = $dest['destination'];
  $this->siteContext = $site;
  $config = \Drupal::config('forena.settings');
  $this->input_format = $config
    ->get('input_format');
  $this->default_skin = $config
    ->get('default_skin');
  $this->doc_formats = $config
    ->get('doc_formats');
  $this->doc_defaults = $config
    ->get('doc_defaults');
}