function mfw_field_widget_value in Multiupload Filefield Widget 7
The #value_callback for the file_mfw field element.
1 string reference to 'mfw_field_widget_value'
File
- ./
multiupload_filefield_widget.field.inc, line 134 - Field module functionality for the Multiple File Widget module.
Code
function mfw_field_widget_value($element, $input = FALSE, &$form_state) {
if ($input) {
// Checkboxes lose their value when empty.
// If the display field is present make sure its unchecked value is saved.
$field = field_widget_field($element, $form_state);
if (empty($input['display'])) {
$input['display'] = $field['settings']['display_field'] ? 0 : 1;
}
}
// We depend on the mfw managed file element to handle uploads.
$return = mfw_managed_file_value($element, $input, $form_state);
// Ensure that all the required properties are returned even if empty.
$return += array(
'fid' => 0,
'display' => 1,
'description' => '',
);
$last_parent = $element['#parents'][count($element['#parents']) - 1];
$form_state['values'][$element['#field_name']]['und'][$last_parent] = $return;
return $return;
}