private function CmisQueryForm::prepareResult in CMIS API 8
Same name and namespace in other branches
- 8.2 src/Form/CmisQueryForm.php \Drupal\cmis\Form\CmisQueryForm::prepareResult()
- 3.0.x src/Form/CmisQueryForm.php \Drupal\cmis\Form\CmisQueryForm::prepareResult()
Prepare results to rendered table.
Parameters
array $results:
Return value
string
1 call to CmisQueryForm::prepareResult()
- CmisQueryForm::queryExec in src/
Form/ CmisQueryForm.php - Execute query string.
File
- src/
Form/ CmisQueryForm.php, line 149
Class
- CmisQueryForm
- Class CmisQueryForm.
Namespace
Drupal\cmis\FormCode
private function prepareResult($results, $query) {
$content = '';
$rows = [];
$table_header = array(
t('Name'),
t('Details'),
t('Author'),
t('Created'),
t('Description'),
t('Operation'),
);
$root = $this->connection
->getRootFolder();
$element = new CmisElement($this->config, FALSE, NULL, $query, $root
->getId());
if ($session = $this->connection
->getSession()) {
foreach ($results as $result) {
$id = $result
->getPropertyValueById('cmis:objectId');
$cid = $session
->createObjectId($id);
if ($object = $session
->getObject($cid)) {
$element
->setElement('query', $object);
$rows[] = $element
->getData();
}
}
if (!empty($rows)) {
$table = [
'#theme' => 'cmis_browser',
'#header' => $table_header,
'#elements' => $rows,
];
$content = render($table);
}
}
return $content;
}