You are here

function private_files_download_permission_remove_directory in Private files download permission 7.2

(Form callback.) Displays a confirmation dialog before removing a directory from the control list.

1 string reference to 'private_files_download_permission_remove_directory'
private_files_download_permission_menu in ./private_files_download_permission.module
Implements hook_menu().

File

./private_files_download_permission.module, line 461
Handles both module settings and its behaviour.

Code

function private_files_download_permission_remove_directory($form, &$form_state, $did) {
  $form = array();

  // Check that $did is actually a valid directory id.
  $directory_list = private_files_download_permission_get_directory_list();
  if (!in_array($did, array_keys($directory_list))) {
    drupal_set_message(t('You need to provide a valid directory id.'), 'error');
    return;
  }

  // Prepare the directory id value to be eventually submitted.
  $form['did'] = array(
    '#type' => 'value',
    '#value' => $did,
  );

  // Display the confirmation form.
  return confirm_form($form, t('Are you sure you want to remove @path from the control list?', array(
    '@path' => $directory_list[$did]->path,
  )), 'admin/config/media/private-files-download-permission', t('This action cannot be undone.'), t('Remove directory from the control list'), t('Cancel'));
}