You are here

private function CmisElement::prepareDocumentElement in CMIS API 8

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

Prepare document element.

Parameters

array $data:

string $operations:

string $id:

1 call to CmisElement::prepareDocumentElement()
CmisElement::prepareElement in src/CmisElement.php
Set element to render array.

File

src/CmisElement.php, line 230

Class

CmisElement
Description of CmisElement

Namespace

Drupal\cmis

Code

private function prepareDocumentElement(&$data, &$operations, $id) {
  $mime_type = $this->element
    ->getContentStreamMimeType();
  if ($this->popup) {
    $url = \Drupal\Core\Url::fromUserInput('/');
    $link_options = array(
      'attributes' => array(
        'class' => array(
          'cmis-field-insert',
        ),
        'id' => $this->element
          ->getProperty('cmis:objectId')
          ->getFirstValue(),
        'name' => $data,
      ),
    );
    $url
      ->setOptions($link_options);
    $path = \Drupal\Core\Link::fromTextAndUrl(t('Choose'), $url)
      ->toRenderable();
    $operations = render($path);
  }
  $url = \Drupal\Core\Url::fromUserInput('/cmis/document/' . $this->config . '/' . $id);
  $path = \Drupal\Core\Link::fromTextAndUrl($data, $url)
    ->toRenderable();
  $data = [
    '#markup' => render($path),
  ];
}