You are here

function node_gallery_images_edit_submit in Node Gallery 6

Same name and namespace in other branches
  1. 6.2 node_gallery.pages.inc \node_gallery_images_edit_submit()
1 string reference to 'node_gallery_images_edit_submit'
node_gallery_edit_images_form in ./node_gallery.pages.inc

File

./node_gallery.pages.inc, line 257
Node gallery pages.

Code

function node_gallery_images_edit_submit($form, &$form_state) {
  foreach ($form_state['values']['files'] as $fid => $form_values) {
    $form_values += $form_values['edit_form'];
    unset($form_values['edit_form']);
    if ($form_values['remove']) {
      $operations[] = array(
        'images_delete_process',
        array(
          new Image($form_values),
        ),
      );
    }
    else {
      if ($form_state['values']['is_cover'] == $fid) {
        $form_values['is_cover'] = 1;
      }
      else {
        $form_values['is_cover'] = 0;
      }
      $operations[] = array(
        'images_upload_process',
        array(
          $form['files'][$fid]['edit_form'],
          new Image($form_values),
        ),
      );
    }
  }
  $batch = array(
    'operations' => $operations,
    'finished' => 'images_process_finished',
    'title' => t('Processing Image Upload.'),
    'init_message' => t('Images Upload is starting.'),
    'progress_message' => t('Processed @current out of @total.'),
    'error_message' => t('Images Upload has encountered an error.'),
  );
  batch_set($batch);
  $form_state['redirect'] = 'node/' . $form_state['values']['gid'];
}