function filefield_paths_temporary_upload_location in File (Field) Paths 7
Recursively set temporary upload location of all File (Field) Paths enabled managed file fields.
Parameters
$element:
1 call to filefield_paths_temporary_upload_location()
- filefield_paths_form_alter in ./
filefield_paths.module - Implements hook_form_alter().
File
- ./
filefield_paths.module, line 199 - Contains core functions for the File (Field) Paths module.
Code
function filefield_paths_temporary_upload_location(&$element) {
if (isset($element['#type']) && $element['#type'] == 'managed_file' && isset($element['#entity_type']) && isset($element['#field_name']) && isset($element['#bundle'])) {
$instance = field_info_instance($element['#entity_type'], $element['#field_name'], $element['#bundle']);
if (isset($instance['settings']['filefield_paths_enabled']) && $instance['settings']['filefield_paths_enabled']) {
$element['#upload_location'] = variable_get('filefield_paths_temp_location', 'public://filefield_paths');
}
return;
}
foreach (element_children($element) as $child) {
filefield_paths_temporary_upload_location($element[$child]);
}
}