You are here

private function CmisBrowser::init in CMIS API 3.0.x

Same name and namespace in other branches
  1. 8.2 src/CmisBrowser.php \Drupal\cmis\CmisBrowser::init()
  2. 8 src/CmisBrowser.php \Drupal\cmis\CmisBrowser::init()

Init variables.

Parameters

string $config: Entity label.

string $folder_id: CMIS folder id.

3 calls to CmisBrowser::init()
CmisBrowser::ajaxCall in src/CmisBrowser.php
Call from ajaxify url.
CmisBrowser::getDocument in src/CmisBrowser.php
Get document by id.
CmisBrowser::__construct in src/CmisBrowser.php
Constructing the object.

File

src/CmisBrowser.php, line 197

Class

CmisBrowser
Description of CmisBrowser.

Namespace

Drupal\cmis

Code

private function init($config, $folder_id) {
  $this->config = $config;
  $this->folderId = $folder_id;
  $this->connection = new CmisConnectionApi($this->config);

  // $cacheable = $this->connection->getConfig()->getCmisCacheable();
  // @TODO: find out the best cache options.
  // $cache_parameters = [
  // 'contexts' => ['user'],
  // 'max-age' => $cacheable ? 300 : 0,
  // ];
  // $this->cacheable = $cache_parameters;.
  if (!empty($this->connection
    ->getHttpInvoker())) {
    $popup = \Drupal::request()->query
      ->get('type');
    $this->popup = $popup == 'popup';
    $this->connection
      ->setDefaultParameters();
    if (empty($this->folderId)) {
      $root_folder = $this->connection
        ->getRootFolder();
      $this->folderId = $root_folder
        ->getId();
      $this->current = $root_folder;
    }
    else {
      $this->current = $this->connection
        ->getObjectById($this->folderId);
    }
  }
}