Elgg  Version 4.3
Annotation.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Menus;
4 
6 
13 class Annotation {
14 
22  public static function registerDelete(\Elgg\Hook $hook) {
23  $annotation = $hook->getParam('annotation');
24  if (!$annotation instanceof \ElggAnnotation || !$annotation->canEdit()) {
25  return;
26  }
27 
28  /* @var $result MenuItems */
29  $return = $hook->getValue();
30 
31  $return[] = \ElggMenuItem::factory([
32  'name' => 'delete',
33  'icon' => 'delete',
34  'text' => elgg_echo('delete'),
35  'href' => elgg_generate_action_url('annotation/delete', [
36  'id' => $annotation->id,
37  ]),
38  'confirm' => elgg_echo('deleteconfirm'),
39  ]);
40 
41  return $return;
42  }
43 }
if($id< 1) $annotation
Definition: delete.php:11
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
Register menu items to the annotation menu.
Definition: Annotation.php:13
static registerDelete(\Elgg\Hook $hook)
Register the generic delete annotation menu item.
Definition: Annotation.php:22