Skip to content

Commit

Permalink
feat(clone): Reorder node actions, move duplicate up
Browse files Browse the repository at this point in the history
  • Loading branch information
torotil committed Jul 25, 2024
1 parent 28c8b57 commit 0de464b
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions campaignion_manage/src/ContentListing.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,19 @@ protected function nodeLinks($node) {
}
}
$destination = ['destination' => 'admin/manage/content_and_actions'];
foreach (array($edit_path_part => t('Edit'), 'translate' => t('Translate'), 'view' => t('View page'), 'delete' => t('Delete')) as $path => $title) {
$action = in_array($path, ['wizard', 'edit']) ? 'update' : $path;
if (node_access($action, $node)) {
$links[$path] = array(
'href' => "node/{$node->nid}/$path",
'title' => $title,
'query' => $destination,
);
}
if (node_access('update', $node)) {
$links['edit'] = [
'href' => "node/{$node->nid}/{$edit_path_part}",
'title' => t('Edit'),
'query' => $destination,
];
}
if (node_access('translate', $node)) {
$links['translate'] = [
'href' => "node/{$node->nid}/translate",
'title' => t('Translate'),
'query' => $destination,
];
}
if (module_exists('clone') && clone_access_cloning($node)) {
$links['clone'] = [
Expand All @@ -144,6 +148,20 @@ protected function nodeLinks($node) {
'query' => $destination,
];
}
if (node_access('view', $node)) {
$links['view'] = [
'href' => "node/{$node->nid}",
'title' => t('View page'),
'query' => $destination,
];
}
if (node_access('delete', $node)) {
$links['delete'] = [
'href' => "node/{$node->nid}/delete",
'title' => t('Delete'),
'query' => $destination,
];
}
return $links;
}

Expand Down

0 comments on commit 0de464b

Please sign in to comment.