function filefield_sources_field_pre_render in FileField Sources 6
Same name and namespace in other branches
- 7 filefield_sources.module \filefield_sources_field_pre_render()
A #pre_render function to hide sources if a file is currently uploaded.
1 string reference to 'filefield_sources_field_pre_render'
- filefield_sources_elements in ./
filefield_sources.module - Implements hook_elements().
File
- ./
filefield_sources.module, line 179 - Extend FileField to allow files from multiple sources.
Code
function filefield_sources_field_pre_render($element) {
// If we already have a file, we don't want to show the upload controls.
if (!empty($element['fid']['#value'])) {
foreach (element_children($element) as $key) {
if (!empty($element[$key]['#filefield_source'])) {
$element[$key]['#access'] = FALSE;
}
}
}
return $element;
}