Elgg  Version master
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\Event $event) {
23  $annotation = $event->getParam('annotation');
24  if (!$annotation instanceof \ElggAnnotation || !$annotation->canEdit()) {
25  return;
26  }
27 
28  /* @var $result MenuItems */
29  $return = $event->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 }
elgg_generate_action_url(string $action, array $query=[], bool $add_csrf_tokens=true)
Generate an action URL.
if($id< 1) $annotation
Definition: delete.php:11
static registerDelete(\Elgg\Event $event)
Register the generic delete annotation menu item.
Definition: Annotation.php:22
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
Entity Annotation.
static factory(array $options)
Create an ElggMenuItem from an associative array.
Register menu items to the annotation menu.
Definition: Annotation.php:13
Models an event passed to event handlers.
Definition: Event.php:11