Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

deleteAnnotation()

Description

Delete annotation

@see getAnnotation()

Parameters

ColumnTypeDefaultDescription
$annotation array Annotation array as returned by getAnnotation()
$ctx array
string} array{k?: $ctx Environment context (e.g. external share)

Return

boolean

Location

include/annotation_functions.php lines 338 to 364

Definition

 
function deleteAnnotation(array $annotation, array $ctx)
{
    if (!
annotationEditable($annotation$ctx)) {
        return 
false;
    }

    
$annotation_ref $annotation['ref'];
    
$parameters = array("i",$annotation_ref);

    
$nodes_to_remove = array();
    foreach (
getAnnotationTags($annotation) as $tag) {
        
$nodes_to_remove[] = $tag['ref'];
    }

    
db_begin_transaction("deleteAnnotation");

    if (
count($nodes_to_remove)) {
        
delete_resource_nodes($annotation['resource'], $nodes_to_remove);
    }

    
ps_query("DELETE FROM annotation_node WHERE annotation = ?"$parameters);
    
ps_query("DELETE FROM annotation WHERE ref = ?"$parameters);

    
db_end_transaction("deleteAnnotation");

    return 
true;
}

This article was last updated 12th July 2025 07:35 Europe/London time based on the source file dated 4th July 2025 10:35 Europe/London time.