You are here

protected function CmisBrowser::setBreadcrumb in CMIS API 8

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

Prepare a breadcrumb url.

Parameters

type $label:

type $name:

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

File

src/CmisBrowser.php, line 355

Class

CmisBrowser
Description of CmisBrowser

Namespace

Drupal\cmis

Code

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