You are here

function views_pdf_template_delete_submit in Views PDF 7.3

Same name and namespace in other branches
  1. 7 views_pdf.admin.inc \views_pdf_template_delete_submit()

Submit function for delete confirmation.

File

./views_pdf.admin.inc, line 202
Theme function for enhence the views admin interface vor PDF options.

Code

function views_pdf_template_delete_submit($form, &$form_state) {
  $uri = $form_state['values']['pdf_uri'];
  $files = file_load_multiple(array(), array(
    'uri' => $uri,
  ));
  if ($file = reset($files)) {
    file_delete($file);
  }
  else {

    // No file record - unmanaged?
    unlink(drupal_realpath($uri));
  }
  drupal_set_message(t('PDF template %name deleted', array(
    '%name' => $form_state['values']['name'],
  )));
  $form_state['redirect'] = 'admin/structure/views/pdfs';
}