You are here

protected function CmisBrowser::setBreadcrumbs in CMIS API 8.2

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

Create breadcrumbs from parent folders.

Parameters

\Dkd\PhpCmis\Data\FolderInterface $folder: Folder name.

1 call to CmisBrowser::setBreadcrumbs()
CmisBrowser::browse in src/CmisBrowser.php
Browse.

File

src/CmisBrowser.php, line 380

Class

CmisBrowser
Description of CmisBrowser.

Namespace

Drupal\cmis

Code

protected function setBreadcrumbs(FolderInterface $folder) {
  $route_name = \Drupal::service('current_route_match')
    ->getRouteName();

  // If the route is not a controller
  // or show_breadcrumb variable is enable, we display it.
  if (strpos($route_name, 'browser') !== FALSE || $this->additionalSettings && $this->additionalSettings['show_breadcrumb']) {
    $name = $folder
      ->getName();
    $id = $folder
      ->getId();
    $entity_config = \Drupal::service('cmis.connection_api')
      ->getConfigFromId($this->config);
    if ($id !== $entity_config
      ->getCmisRootFolder()) {
      $this
        ->setBreadcrumb($name, $id);
      if ($parent = $folder
        ->getFolderParent()) {
        $this
          ->setBreadcrumbs($parent);
      }
    }
    else {
      $this
        ->setBreadcrumb($this
        ->t('Root'), $id);
    }
  }
}