You are here

function social_content_import_run_form_submit in Social Content 7.2

Same name and namespace in other branches
  1. 7 social_content.admin.inc \social_content_import_run_form_submit()

Submit handler for social_content_import_run_form().

Run the selected import (regardless of whether it's enabled on cron). Report back results to the user.

NOTE: This should really be in a batch job, but because cron doesn't currently run on batch it was decided to simulate the request here.

File

./social_content.admin.inc, line 186
Social Content administration area. Provides menu callbacks for the Social Content administration area.

Code

function social_content_import_run_form_submit($form, &$form_state) {
  if (isset($form['#storage']) && isset($form['#storage']['class'])) {
    $class = $form['#storage']['class'];
    $stats = $class
      ->import();
    $args = array(
      '%title' => $class
        ->getInstanceTitle(),
      '!processed' => $stats['processed'],
      '!imported' => $stats['imported'],
      '!skipped' => $stats['skipped'],
    );
    drupal_set_message(t('%title run successfully, processed !processed, imported !imported, skipped !skipped nodes', $args));
  }
}