Is there a way to delete a bunch of tv's (chunks etc.) at once?
Thank you.
I imagine you can remove them straight from the DB under table modx_site_tmplvars. Pretty easy to navigate with phpMyAdmin etc.
Check the ones you would like to delete and drop them.
However don't do this before someone else confirming this or do a backup of the whole DB first then try it, anything goes wrong just drop the broken DB and re-import the original one.
Twitter @alexmercenary
try this only when you know what you're doing and only at a unpublished resource or from manager.
snippet:
$classname = $modx->getOption('classname',$scriptProperties,'modTemplateVar');
if (isset($_POST['removeElements'])){
foreach ($_POST['row_id'] as $id){
$object = $modx->getObject($classname,$id);
$object->remove();
}
}
$collection = $modx->getCollection($classname);
foreach ($collection as $object){
$fields = $object->toArray();
$trs .= '<tr><td>'.$fields['name'].'</td><td><input type="checkbox" name="row_id[]" value="'.$fields['id'].'" /></td>';
}
$form = '<form method="post" action=""> <table>'.$trs.'</table><input type="submit" name="removeElements" /> </form>';
return $form;
example of snippet-call:
[[!removeElements? &classname=`modChunk`]]