asset_delete_submit($form, &$form_state)This function deletes an asset and optionally all mediafiles within it.
vpx_beheer_mm/asset/asset.module, line 303
<?php
function asset_delete_submit($form, &$form_state) {
$vpx = new vpx_connector();
$asset_id = $form_state['values']['asset_id'];
$url = '/asset/'. $asset_id .'/delete';
// check if the user also wants to remove all mediafiles from the asset
if ($form_state['values']['cascade'] === 1) {
$url .= '?delete=cascade';
}
// fetch the app_id (if needed)
$app_id = FALSE;
if ($vpx->masquerade_owner) {
$result = $vpx->request('GET', '/asset/'. $asset_id);
$app_id = (int)$result->items->item->app_id;
}
// delete the asset
$result = $vpx->request('POST', $url, NULL, TRUE, $app_id);
if ($vpx->check_result($result, FALSE, '%message') === TRUE) {
drupal_goto(variable_get('vpx_connector_menu_prefix', '') .'asset');
}
else {
drupal_goto(variable_get('vpx_connector_menu_prefix', '') .'asset/'. $asset_id);
}
}
?>