$deletedids = $modx->event->params['ids'];
$countid = count($deletedids);
$i = 0;
while($i <= $countid-1){
$doc = $modx->getDocument($deletedids[$i]);
$templateid = $doc['template'];
//here switching $templateid and selecting correct table name
$rows_affected = $modx->db->delete($table, "gal_id = $deletedids[$i]");
$dir = $modx->config['base_path']."/assets/galleries/".$deletedids[$i];
delete_directory($dir);
$i++;
}
this will work only for snippet calls placed in templates, and you have to personalize the code depending on your template id.
I was looking for something to partially parse the template, because I’ve got snippet calls placed in chunks, so if I directly read the >able parameter from templates, I can’t find anything.
Also, this is not working for snippet calls placed in content (but I guess it won’t be so difficult to get this).
Note that if you use different tables depending from the template, when you switch the template in the document, some data remains in the table and it will not deleted when you purge the document.
I know, I’m a pain in the ass :-P
Cheers,
Roberto