You are here

function scald_dailymotion_search_form_submit in Scald: Media Management made easy 6

Handlers import form submission.

1 string reference to 'scald_dailymotion_search_form_submit'
scald_dailymotion_search_form in scald_dailymotion/scald_dailymotion.pages.inc
Generates the search and search results form.

File

scald_dailymotion/scald_dailymotion.pages.inc, line 81
Contains form handlers for the DailyMotion search form.

Code

function scald_dailymotion_search_form_submit($form, &$form_state) {
  $ids = array();

  // Find all the elements that have been checked in the results table
  foreach ($form_state['values']['results'] as $id => $element) {
    if ($element['checkbox']) {
      $ids[] = $id;
    }
  }

  // And now create an atom for each of them
  foreach ($ids as $id) {
    $sid = scald_dailymotion_register($id);
    $video = scald_fetch($sid);
    drupal_set_message(t('Created video %title', array(
      '%title' => $video->title,
    )));
  }

  // End the multistep workflow
  unset($form_state['storage']);
  $form_state['rebuild'] = FALSE;
}