Collections functions
General functions
Render functions
Theme permission functions
Resource functions

deleteAnnotation()

Description

Delete annotation

@see getAnnotation()

Parameters

ColumnTypeDefaultDescription
$annotation array Annotation array as returned by getAnnotation()

Return

boolean

Location

include/annotation_functions.php lines 278 to 307

Definition

 
function deleteAnnotation(array $annotation)
    {
    if(!
annotationEditable($annotation))
        {
        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 2nd October 2022 17:05 Europe/London time based on the source file dated 29th July 2022 11:20 Europe/London time.