Skip to content

Commit

Permalink
feature(menus): delete menu item now checks if delete action exists
Browse files Browse the repository at this point in the history
Delete menu item in entity menu now checks if the action for $handler/delete is registered,
and defaults to core delete action if not.
  • Loading branch information
hypeJunction committed Dec 22, 2015
1 parent 4c35fe2 commit 84cbb15
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion engine/lib/navigation.php
Expand Up @@ -487,11 +487,16 @@ function _elgg_entity_menu_setup($hook, $type, $return, $params) {
$return[] = \ElggMenuItem::factory($options);

// delete link
if (elgg_action_exists("$handler/delete")) {
$action = "action/$handler/delete";
} else {
$action = "action/entity/delete";
}
$options = array(
'name' => 'delete',
'text' => elgg_view_icon('delete'),
'title' => elgg_echo('delete:this'),
'href' => "action/$handler/delete?guid={$entity->getGUID()}",
'href' => "$action?guid={$entity->getGUID()}",
'confirm' => elgg_echo('deleteconfirm'),
'priority' => 300,
);
Expand Down

0 comments on commit 84cbb15

Please sign in to comment.