You are here

function _metatag_importer_finished in Metatag 7

BatchAPI callback for when the import finishes.

1 string reference to '_metatag_importer_finished'
_metatag_importer_import in metatag_importer/metatag_importer.nodewords.inc
Migrates Nodewords data to the Metatag module.

File

metatag_importer/metatag_importer.nodewords.inc, line 368
Convert data from Nodewords to Metatag.

Code

function _metatag_importer_finished($success, $results, $operations) {
  if ($success) {
    if (drupal_is_cli() && function_exists('drush_print')) {

      // Make a bulleted list of messages for the command line.
      foreach ($results as $result) {
        drush_print(dt('* ' . $result));
      }
    }
    else {

      // Make a bulleted list of messages for the browser.
      $message = theme('item_list', array(
        'items' => $results,
      ));
      drupal_set_message(t($message));
    }
  }
  else {

    // An error occurred.
    // $operations contains the operations that remained unprocessed.
    $error_operation = reset($operations);
    $message = 'An error occurred while processing %error_operation';
    $vars = array(
      '%error_operation' => $error_operation[0],
    );
    if (drupal_is_cli() && function_exists('drush_print')) {
      drush_set_error('metatag_importer', dt($message, $vars));
    }
    else {
      $message .= ' with arguments: @arguments';
      $vars[] = array(
        '@arguments' => print_r($error_operation[1], TRUE),
      );
      drupal_set_message(t($message, $vars), 'error');
    }
  }
}