You are here

public function CmisBrowser::getDocumentProperties in CMIS API 8

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

Get document properties.

Return value

array the renderable array

File

src/CmisBrowser.php, line 153

Class

CmisBrowser
Description of CmisBrowser

Namespace

Drupal\cmis

Code

public function getDocumentProperties() {
  if ($this->connection && !empty($this->current)) {
    $type_id = $this->current
      ->getBaseTypeId()
      ->__toString();
    $path = [];
    if ($type_id == 'cmis:document') {
      $url = \Drupal\Core\Url::fromUserInput('/cmis/document/' . $this->config . '/' . $this->current
        ->getId());
      $path = \Drupal\Core\Link::fromTextAndUrl(t('Download'), $url)
        ->toRenderable();
    }
    return [
      '#theme' => 'cmis_content_properties',
      '#object' => $this->current,
      '#download' => render($path),
    ];
  }
}