You are here

function _webform_edit_file_check_directory in Webform 5.2

Same name and namespace in other branches
  1. 5 components/file.inc \_webform_edit_file_check_directory()
  2. 6.3 components/file.inc \_webform_edit_file_check_directory()
  3. 6.2 components/file.inc \_webform_edit_file_check_directory()
  4. 7.4 components/file.inc \_webform_edit_file_check_directory()
  5. 7.3 components/file.inc \_webform_edit_file_check_directory()
1 string reference to '_webform_edit_file_check_directory'
_webform_edit_file in components/file.inc
Create a set of form items to be displayed on the form for editing this component. Use care naming the form items, as this correlates directly to the database schema. The component "Name" and "Description" fields are added to every…

File

components/file.inc, line 136
Webform module file component.

Code

function _webform_edit_file_check_directory($form_element) {
  $base_dir = file_directory_path() . '/webform';
  $base_success = file_check_directory($base_dir, FILE_CREATE_DIRECTORY);
  $destination_dir = $base_dir . '/' . $form_element['#value'];
  $destination_success = file_check_directory($destination_dir, FILE_CREATE_DIRECTORY);
  if (!$base_success || !$destination_success) {
    form_set_error('savelocation', t('The save directory %directory could not be created. Check that the webform files directory is writtable.', array(
      '%directory' => $destination_dir,
    )));
  }
  return $form_element;
}