Skip to content

Commit

Permalink
chore: allow delete menu item for concept/approval groups
Browse files Browse the repository at this point in the history
  • Loading branch information
jeabakker committed Jul 5, 2021
1 parent 2ae4027 commit ccbb9c8
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions classes/ColdTrick/GroupTools/TitleMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,24 @@ public static function pendingApproval(\Elgg\Hook $hook) {

$allowed_items = [
'edit',
'delete',
];

/* @var $return MenuItems */
$return = $hook->getValue();

// cleanup all items
$items = [];
/* @var $menu_item \ElggMenuItem */
foreach ($allowed_items as $name) {
$items[] = $return->get($name);
/* @var $item \ElggMenuItem */
$item = $return->get($name);
$items[] = $item;

// some items could be in a submenu
$parent_name = $item->getParentName();
if (!empty($parent_name)) {
$items[] = $return->get($parent_name);
}
}

$return->fill($items);
Expand Down Expand Up @@ -358,16 +366,24 @@ public static function conceptGroup(\Elgg\Hook $hook) {

$allowed_items = [
'edit',
'delete',
];

/* @var $return MenuItems */
$return = $hook->getValue();

// cleanup all items
$items = [];
/* @var $menu_item \ElggMenuItem */
foreach ($allowed_items as $name) {
$items[] = $return->get($name);
/* @var $item \ElggMenuItem */
$item = $return->get($name);
$items[] = $item;

// some items could be in a submenu
$parent_name = $item->getParentName();
if (!empty($parent_name)) {
$items[] = $return->get($parent_name);
}
}

$return->fill($items);
Expand Down

0 comments on commit ccbb9c8

Please sign in to comment.