You are here

function hide_submit_admin_delete_image in Hide submit button 6

Same name and namespace in other branches
  1. 5 hide_submit_admin.inc \hide_submit_admin_delete_image()
  2. 7 hide_submit_admin.inc \hide_submit_admin_delete_image()

Image deletion confirmation form

Parameters

&$form_state:

$filename - The file to delete:

Return value

drupal form array

1 string reference to 'hide_submit_admin_delete_image'
hide_submit_menu in ./hide_submit.module
Implementation of hook_menu

File

./hide_submit_admin.inc, line 18
Hide the submit button after clicked to prevent/reduce duplicate postings.

Code

function hide_submit_admin_delete_image(&$form_state, $filename) {
  $filepath = HIDE_SUBMIT_IMG_DIRECTORY . '/' . $filename;
  if (!file_exists(HIDE_SUBMIT_IMG_DIRECTORY . '/' . $filename)) {
    drupal_goto('admin/settings/hide-submit');
  }
  $form['hide_submit_image_file_path'] = array(
    '#type' => 'value',
    '#value' => $filepath,
  );
  $form['hide_submit_image_file_name'] = array(
    '#type' => 'value',
    '#value' => $filename,
  );
  $msg = t('Are you sure you want to delete the image file %name', array(
    '%name' => check_plain($filename),
  ));
  return confirm_form($form, $msg, 'admin/settings/hide-submit');
}