You are here

private function CmisElement::prepareDocumentElement in CMIS API 3.0.x

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

Prepare document element.

Parameters

string $data: Get data.

string $operations: Get render.

string $id: CMIS object id.

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

File

src/CmisElement.php, line 220

Class

CmisElement
Description of CmisElement.

Namespace

Drupal\cmis

Code

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