Permalink
Browse files

feature(menus): delete menu item now checks if delete action exists

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 8, 2015
1 parent 4c35fe2 commit 84cbb1518e021cc7d17aee4bc83c30b2d10edfe0
Showing with 6 additions and 1 deletion.
  1. +6 −1 engine/lib/navigation.php
@@ -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,
);

0 comments on commit 84cbb15

Please sign in to comment.