You are here

function scald_atom_delete_confirm_submit in Scald: Media Management made easy 7

Execute atom deletion.

File

includes/scald.pages.inc, line 479
This file contains the various callbacks related to Scald defined pages.

Code

function scald_atom_delete_confirm_submit($form, &$form_state) {
  if ($form_state['values']['confirm']) {
    $atom = scald_atom_load($form_state['values']['sid']);
    scald_atom_delete($atom->sid);
    watchdog('scald_atom', '@type: deleted %title.', array(
      '@type' => $atom->type,
      '%title' => $atom->title,
    ));
    $types = scald_types();
    $type = scald_type_property_translate($types[$atom->type]);
    drupal_set_message(t('@type %title has been deleted.', array(
      '@type' => $type,
      '%title' => $atom->title,
    )));
  }
  if (!empty($form_state['input']['js'])) {
    ctools_include('modal');
    ctools_include('ajax');
    $commands = array();
    $commands[] = array(
      'command' => 'dnd_refresh',
    );
    $commands[] = ctools_modal_command_dismiss();
    print ajax_render($commands);
    exit;
  }
  else {
    $form_state['redirect'] = 'admin/content/atoms';
  }
}