You are here

protected function CmisBrowser::setBreadcrumb in CMIS API 3.0.x

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

Prepare a breadcrumb url.

Parameters

mixed $label: Breadcrumb label.

string $id: Folder id.

1 call to CmisBrowser::setBreadcrumb()
CmisBrowser::setBreadcrumbs in src/CmisBrowser.php
Create breadcrumbs from parent folders.

File

src/CmisBrowser.php, line 406

Class

CmisBrowser
Description of CmisBrowser.

Namespace

Drupal\cmis

Code

protected function setBreadcrumb($label, $id) {
  $path = '/cmis/browser/nojs/' . $this->config;
  if (!empty($id)) {
    $path .= '/' . $id;
  }
  $url = Url::fromUserInput($path);
  $link_options = [
    'attributes' => [
      'class' => [
        'use-ajax',
      ],
    ],
  ];
  if ($this->popup) {
    $link_options['query'] = [
      'type' => 'popup',
    ];
  }
  $url
    ->setOptions($link_options);
  $item = Link::fromTextAndUrl($label, $url);
  array_unshift($this->breadcrumbs, $item);
}