You are here

function scald_gallery_submit_items in Scald: Gallery 7.2

Special form submit handler to temporarily save a gallery atom.

Save the current form into object cache so that it could be restored later. It also updates the gallery data with items title and description.

1 string reference to 'scald_gallery_submit_items'
scald_gallery_form_scald_atom_add_form_options_alter in ./scald_gallery.module
Implements hook_form_FORM_ID_alter().

File

./scald_gallery.module, line 166
Scald Gallery is a Scald Atom Provider for image galleries.

Code

function scald_gallery_submit_items(&$form, &$form_state) {
  if (empty($form_state['scald']['atoms'])) {
    return;
  }
  $atoms = $form_state['scald']['atoms'];
  $atom = reset($atoms);

  // Save extra gallery items title and description.
  $atom->data['items'] = array();
  $gallery_items_langcode = $form['atom0']['gallery_items']['#language'];
  foreach ($form_state['values']['atom0']['gallery_items'][$gallery_items_langcode] as $input) {
    if (empty($input['sid'])) {
      continue;
    }
    $atom->data['items'][$input['sid']] = array(
      'title_overriden' => $input['title_overriden'],
      'title' => $input['title'],
      'description' => $input['description'],
    );
  }
  $form['#submit'] = $form_state['original_submit_handlers'];
  form_execute_handlers('submit', $form, $form_state);
}