Elgg  Version 4.3
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\Hook $hook) {
23 
24  $item = $hook->getParam('item');
25  if (!$item instanceof \ElggRiverItem || !$item->canDelete()) {
26  return;
27  }
28 
29  /* @Var $return MenuItems */
30  $return = $hook->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($action, array $query=[], $add_csrf_tokens=true)
Generate an action URL.
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
static factory($options)
Create an ElggMenuItem from an associative array.
Models an event passed to hook handlers.
Definition: Hook.php:11
static registerDelete(\Elgg\Hook $hook)
Add the delete to river actions menu.
Definition: River.php:22
Register menu items to the river menu.
Definition: River.php:13