You are here

function template_preprocess_cmis_browser in CMIS API 3.0.x

Same name and namespace in other branches
  1. 8.2 cmis.module \template_preprocess_cmis_browser()
  2. 8 cmis.module \template_preprocess_cmis_browser()

Implements hook_preprocess_cmis_browser().

File

./cmis.module, line 91

Code

function template_preprocess_cmis_browser(&$variables) {
  $breadcrumbs = [
    '#theme' => 'item_list',
    '#items' => $variables['breadcrumbs'],
    '#list_type' => 'ol',
    // In case the theme is using an item-list template without wrapper.
    '#attributes' => [
      'class' => [
        'breadcrumb',
      ],
    ],
    // In case the theme is using an item-list template with a wrapper, such as
    // Bartik which also force an 'item-list' class.
    '#wrapper_attributes' => [
      'class' => [
        'breadcrumb',
        'js-cmis-breadcrumb',
      ],
    ],
  ];
  $variables['breadcrumbs'] = $breadcrumbs;
  $variables['#attached']['library'][] = 'core/drupal.ajax';
  $table = [
    '#theme' => 'table',
    '#header' => $variables['header'],
    '#rows' => $variables['elements'],
    '#empty' => t('This folder is empty.'),
    '#sticky' => TRUE,
  ];
  $variables['table'] = $table;
}