public function CmisRepositoryController::objectDeleteVerify in CMIS API 8
Same name and namespace in other branches
- 8.2 src/Controller/CmisRepositoryController.php \Drupal\cmis\Controller\CmisRepositoryController::objectDeleteVerify()
- 3.0.x src/Controller/CmisRepositoryController.php \Drupal\cmis\Controller\CmisRepositoryController::objectDeleteVerify()
Object delete verify popup.
Parameters
string $config:
string $document_id:
1 string reference to 'CmisRepositoryController::objectDeleteVerify'
File
- src/
Controller/ CmisRepositoryController.php, line 73
Class
- CmisRepositoryController
- Class CmisRepositoryController.
Namespace
Drupal\cmis\ControllerCode
public function objectDeleteVerify($config = '', $object_id = '') {
$parameters = \Drupal::request()->query
->all();
unset($parameters['_wrapper_format']);
$type = '';
$name = '';
if (!empty($parameters['type']) && !empty($config) && !empty($object_id) && (!empty($parameters['parent']) || !empty($parameters['query_string']))) {
$this
->setConnection($config);
if ($this->connection) {
if ($current = $this->connection
->getObjectById($object_id)) {
$type = $current
->getBaseTypeId()
->__toString();
$name = $current
->getName();
}
else {
return [
'#theme' => 'cmis_object_delete_verify',
'#title' => $this
->t("Object can't delete"),
'#description' => $this
->t('Object not found in repository.'),
'#link' => '',
];
}
}
}
else {
return [
'#theme' => 'cmis_object_delete_verify',
'#title' => $this
->t("Object can't delete"),
'#description' => $this
->t('Argument or parameter missed.'),
'#link' => '',
];
}
$args = [
'@type' => str_replace('cmis:', '', $type),
'@name' => $name,
];
$url = \Drupal\Core\Url::fromUserInput('/cmis/object-delete/' . $config . '/' . $object_id);
$link_options = [
'query' => $parameters,
];
$url
->setOptions($link_options);
$path = \Drupal\Core\Link::fromTextAndUrl(t('Delete'), $url)
->toRenderable();
$link = render($path);
return [
'#theme' => 'cmis_object_delete_verify',
'#title' => $this
->t('Are you sure you want to delete @type name @name', $args),
'#description' => $this
->t('This action cannot be undone.'),
'#link' => $link,
];
}