}
// Check access for edit/update links
// (presumably if a record is shown in SearchKit the user already has view access, and the check is expensive)
- if ($path && isset($data) && $link['action'] !== 'view') {
+ if ($path && isset($data) && !in_array($link['action'], ['view', 'preview'], TRUE)) {
$id = $data[$prefix . $idKey] ?? NULL;
$id = is_array($id) ? $id[$index] ?? NULL : $id;
if ($id) {
$access = civicrm_api4($link['entity'], 'checkAccess', [
- 'action' => $link['action'],
+ // Fudge links with funny action names to check 'update'
+ 'action' => $link['action'] === 'delete' ? 'delete' : 'update',
'values' => [
$idField => $id,
],
// Contacts and cases are too cumbersome to view in a popup
'target' => in_array($entity, ['Contact', 'Case']) ? '_blank' : 'crm-popup',
],
+ 'preview' => [
+ 'action' => 'preview',
+ 'entity' => $entity,
+ 'text' => E::ts('Preview %1', $label),
+ 'icon' => 'fa-eye',
+ 'style' => 'default',
+ 'target' => 'crm-popup',
+ ],
'update' => [
'action' => 'update',
'entity' => $entity,
// Contacts and cases are too cumbersome to edit in a popup
'target' => in_array($entity, ['Contact', 'Case']) ? '_blank' : 'crm-popup',
],
+ 'move' => [
+ 'action' => 'move',
+ 'entity' => $entity,
+ 'text' => E::ts('Move %1', $label),
+ 'icon' => 'fa-random',
+ 'style' => 'default',
+ 'target' => 'crm-popup',
+ ],
'delete' => [
'action' => 'delete',
'entity' => $entity,