Elgg  Version master
delete.php
Go to the documentation of this file.
1 <?php
6 $id = (int) get_input('id');
7 if ($id < 1) {
8  return elgg_error_response(elgg_echo('error:missing_data'));
9 }
10 
12 if (!$annotation instanceof ElggAnnotation) {
13  return elgg_error_response(elgg_echo('error:missing_data'));
14 }
15 
16 if (!$annotation->canEdit()) {
17  return elgg_error_response(elgg_echo('actionunauthorized'));
18 }
19 
21  'annotation' => $annotation->toObject(),
22 ];
23 
24 if (!$annotation->delete()) {
25  $lan_key = "annotation:delete:{$annotation->name}:fail";
27  $lan_key = 'annotation:delete:fail';
28  }
29 
31 }
32 
33 $lan_key = "annotation:delete:{$annotation->name}:success";
35  $lan_key = 'annotation:delete:success';
36 }
37 
if($id< 1) $annotation
Definition: delete.php:11
if(!$annotation instanceof ElggAnnotation) if(!$annotation->canEdit()) $ok_content
Definition: delete.php:20
elgg_ok_response($content= '', string|array $message= '', string $forward_url=null, int $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
Entity Annotation.
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
elgg_language_key_exists(string $key, string $language= 'en')
Check if a given language key exists.
Definition: languages.php:44
elgg_error_response(string|array $message= '', string $forward_url=REFERRER, int $status_code=ELGG_HTTP_BAD_REQUEST)
Prepare an error response to be returned by a page or an action handler.
if(!$annotation instanceof ElggAnnotation) if(!$annotation->canEdit()) if(!$annotation->delete()) $lan_key
Definition: delete.php:33
elgg_get_annotation_from_id(int $id)
Elgg annotations Functions to manage object annotations.
Definition: annotations.php:16
$id
Generic annotation delete action.
Definition: delete.php:6