private function CmisBrowser::prepareOperations in CMIS API 8
Same name and namespace in other branches
- 8.2 src/CmisBrowser.php \Drupal\cmis\CmisBrowser::prepareOperations()
- 3.0.x src/CmisBrowser.php \Drupal\cmis\CmisBrowser::prepareOperations()
Prepare operation links.
Return value
string
1 call to CmisBrowser::prepareOperations()
- CmisBrowser::browse in src/
CmisBrowser.php - Browse.
File
- src/
CmisBrowser.php, line 276
Class
- CmisBrowser
- Description of CmisBrowser
Namespace
Drupal\cmisCode
private function prepareOperations() {
if (!\Drupal::currentUser()
->hasPermission('access cmis operations')) {
return '';
}
$routes = [
'/cmis/browser-create-folder/' => t('Create folder'),
'/cmis/browser-upload-document/' => t('Add document'),
];
$links = [];
foreach ($routes as $route => $title) {
$url = \Drupal\Core\Url::fromUserInput($route . $this->config . '/' . $this->current
->getId());
$link_options = array(
'attributes' => array(
'class' => [
'use-ajax',
],
'data-dialog-type' => 'modal',
'data-dialog-options' => \Drupal\Component\Serialization\Json::encode([
'height' => 400,
'width' => 700,
]),
),
);
$url
->setOptions($link_options);
$path = \Drupal\Core\Link::fromTextAndUrl($title, $url)
->toRenderable();
$links[] = [
'#markup' => render($path),
'#wrapper_attributes' => [
'class' => [
'object-properties',
],
],
];
}
$list = [
'#theme' => 'item_list',
'#items' => $links,
'#type' => 'ul',
];
return render($list);
}