$resource_ref, 'resource_type_field' => $rtf_tags, 'page' => 0, 'tags' => [], 'shapes' => [ [ 'type' => 'rect', 'geometry' => [ 'x' => 0.10, 'y' => 0.20, 'width' => 0.50, 'height' => 0.60, ], ] ], ]; $annotation_ref = createAnnotation($annotation); $annotation['ref'] = $annotation_ref; // No nodes to add if (addAnnotationNodes($annotation_ref, []) !== false) { echo 'No nodes to add - '; return false; } // Add nodes to annotation if ( addAnnotationNodes($annotation_ref, [$node_optionA, $node_optionB]) !== false && array_column(getAnnotationTags([$annotation][0]), 'ref') !== [$node_optionA['ref'], $node_optionB['ref']] ) { echo 'Adding nodes to annotation - '; return false; } // Tear down unset($rtf_tags, $annotate_fields, $node_optionA, $node_optionB, $resource_ref, $annotation, $annotation_ref); return true;