Elgg  Version 4.3
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 
elgg_language_key_exists($key, $language= 'en')
Check if a given language key exists.
Definition: languages.php:46
if($id< 1) $annotation
Definition: delete.php:11
if(!$annotation instanceof ElggAnnotation) if(!$annotation->canEdit()) $ok_content
Definition: delete.php:20
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
get_input($variable, $default=null, $filter_result=true)
Parameter input functions.
Definition: input.php:20
if(!$annotation instanceof ElggAnnotation) if(!$annotation->canEdit()) if(!$annotation->delete()) $lan_key
Definition: delete.php:33
elgg_error_response($message= '', $forward_url=REFERRER, int $status_code=ELGG_HTTP_BAD_REQUEST)
Prepare an error response to be returned by a page or an action handler.
elgg_get_annotation_from_id(int $id)
Elgg annotations Functions to manage object annotations.
Definition: annotations.php:16
elgg_ok_response($content= '', $message= '', $forward_url=null, int $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
$id
Generic annotation delete action.
Definition: delete.php:6