Collections functions
Encryption functions
General 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 272 to 300

Definition

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

    
$annotation_ref escape_check($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(escape_check($annotation['resource']), $nodes_to_remove);
        }

    
sql_query("DELETE FROM annotation_node WHERE annotation = '{$annotation_ref}'");
    
sql_query("DELETE FROM annotation WHERE ref = '{$annotation_ref}'");

    
db_end_transaction("deleteAnnotation");

    return 
true;
    }

This article was last updated 13th July 2020 15:05 Europe/London time based on the source file dated 17th January 2020 16:11 Europe/London time.