function fupload_list_images_submit in Image FUpload 6.2
Same name and namespace in other branches
- 6.3 includes/images.previewlist.inc \fupload_list_images_submit()
- 6 includes/images.previewlist.inc \fupload_list_images_submit()
File
- includes/
images.previewlist.inc, line 89
Code
function fupload_list_images_submit($form, &$form_state) {
// get nids of images and start batch process (saving)
$image_nids = explode(';', $form_state['values']['image_nodes']);
for ($i = 0; $i < count($image_nids); $i++) {
// load full node object
$node = node_load($image_nids[$i]);
// new changes to node object
$node->status = 1;
// publish node
$node->title = !empty($form_state['values']['title_' . $image_nids[$i]]) ? $form_state['values']['title_' . $image_nids[$i]] : $node->title;
// work around [#227966]
$node->body = $form_state['values']['body_' . $image_nids[$i]];
if ($node->body == IMAGE_NOT_COMPLETED || !isset($form_state['values']['body_' . $image_nids[$i]])) {
// nothing changed ==> empty body field
$node->body = "";
}
$node->teaser = node_teaser($node->body, $form_state['values']['format_' . $image_nids[$i]]);
$node->format = $form_state['values']['format_' . $image_nids[$i]];
// save new node object
node_save($node);
}
drupal_set_message(t('All images have been saved and published.'));
drupal_set_message(t('Additonal images can be selected and uploaded now.'));
drupal_redirect_form($form);
}