Elgg  Version master
River.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Menus;
4 
6 
13 class River {
14 
22  public static function registerDelete(\Elgg\Event $event) {
23 
24  $item = $event->getParam('item');
25  if (!$item instanceof \ElggRiverItem || !$item->canDelete()) {
26  return;
27  }
28 
29  /* @Var $return MenuItems */
30  $return = $event->getValue();
31 
32  $return[] = \ElggMenuItem::factory([
33  'name' => 'delete',
34  'icon' => 'delete',
35  'text' => elgg_echo('river:delete'),
36  'href' => elgg_generate_action_url('river/delete', [
37  'id' => $item->id,
38  ]),
39  'confirm' => elgg_echo('deleteconfirm'),
40  'priority' => 999,
41  ]);
42 
43  return $return;
44  }
45 }
if(!$items) $item
Definition: delete.php:13
elgg_generate_action_url(string $action, array $query=[], bool $add_csrf_tokens=true)
Generate an action URL.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
static factory(array $options)
Create an ElggMenuItem from an associative array.
static registerDelete(\Elgg\Event $event)
Add the delete to river actions menu.
Definition: River.php:22
Register menu items to the river menu.
Definition: River.php:13
Models an event passed to event handlers.
Definition: Event.php:11