Unverified Commit aaf5d6ed authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:sparkles: feat(management) Extend ObjectTypeColumn to be able to plug it on a field

Used by archive plugin

issue #6119
Showing with 20 additions and 4 deletions
+20 -4
......@@ -30,12 +30,28 @@ class ObjectTypeColumn extends Column
function renderCell (ListingEntry $entry): string
{
if ($entry->isTemplate()) {
if (isset($this->attributes)) {
$isTemplate = FALSE;
$types = $this->getAttributeValues($entry);
} else {
$isTemplate = $entry->isTemplate();
if ($entry->type) {
$types = [$entry->type];
} else {
$types = [];
}
}
if ($isTemplate) {
$infos = objects::infos($entry->getTemplatedType());
return '<img title="'.htmlescape($entry->dn).'" src="'.htmlescape('geticon.php?context=devices&icon=template&size=16').'" alt="'.htmlescape(sprintf(_('%s template'), $infos['name'])).'"/>';
} elseif ($entry->type) {
$infos = objects::infos($entry->type);
return '<img title="'.htmlescape($entry->dn).'" src="'.htmlescape($infos['icon']).'" alt="'.htmlescape($infos['name']).'"/>';
} elseif (!empty($types)) {
$cell = '';
foreach ($types as $type) {
$infos = objects::infos($type);
$title = (isset($this->attributes) ? $infos['name'] : $entry->dn);
$cell .= '<img title="'.htmlescape($title).'" src="'.htmlescape($infos['icon']).'" alt="'.htmlescape($infos['name']).'"/>';
}
return $cell;
} else {
return '&nbsp;';
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment