drupal core updated to 7.28
This commit is contained in:
@@ -186,7 +186,7 @@ function file_field_load($entity_type, $entities, $field, $instances, $langcode,
|
||||
$items[$id][$delta] = NULL;
|
||||
}
|
||||
else {
|
||||
$items[$id][$delta] = array_merge($item, (array) $files[$item['fid']]);
|
||||
$items[$id][$delta] = array_merge((array) $files[$item['fid']], $item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,8 +215,16 @@ function file_field_presave($entity_type, $entity, $field, $instance, $langcode,
|
||||
// Make sure that each file which will be saved with this object has a
|
||||
// permanent status, so that it will not be removed when temporary files are
|
||||
// cleaned up.
|
||||
foreach ($items as $item) {
|
||||
foreach ($items as $delta => $item) {
|
||||
if (empty($item['fid'])) {
|
||||
unset($items[$delta]);
|
||||
continue;
|
||||
}
|
||||
$file = file_load($item['fid']);
|
||||
if (empty($file)) {
|
||||
unset($items[$delta]);
|
||||
continue;
|
||||
}
|
||||
if (!$file->status) {
|
||||
$file->status = FILE_STATUS_PERMANENT;
|
||||
file_save($file);
|
||||
@@ -760,7 +768,7 @@ function file_field_widget_submit($form, &$form_state) {
|
||||
$langcode = $element['#language'];
|
||||
$parents = $element['#field_parents'];
|
||||
|
||||
$submitted_values = drupal_array_get_nested_value($form_state['values'], array_slice($button['#array_parents'], 0, -2));
|
||||
$submitted_values = drupal_array_get_nested_value($form_state['values'], array_slice($button['#parents'], 0, -2));
|
||||
foreach ($submitted_values as $delta => $submitted_value) {
|
||||
if (!$submitted_value['fid']) {
|
||||
unset($submitted_values[$delta]);
|
||||
@@ -771,7 +779,7 @@ function file_field_widget_submit($form, &$form_state) {
|
||||
$submitted_values = array_values($submitted_values);
|
||||
|
||||
// Update form_state values.
|
||||
drupal_array_set_nested_value($form_state['values'], array_slice($button['#array_parents'], 0, -2), $submitted_values);
|
||||
drupal_array_set_nested_value($form_state['values'], array_slice($button['#parents'], 0, -2), $submitted_values);
|
||||
|
||||
// Update items.
|
||||
$field_state = field_form_get_state($parents, $field_name, $langcode, $form_state);
|
||||
|
||||
Reference in New Issue
Block a user