ConfigSync::finishBatch

public static ConfigSync::finishBatch($success, $results, $operations)

Finish batch.

This function is a static function to avoid serializing the ConfigSync object unnecessarily.

File

core/modules/config/src/Form/ConfigSync.php, line 392

Class

ConfigSync
Construct the storage changes in a configuration synchronization form.

Namespace

Drupal\config\Form

Code

public static function finishBatch($success, $results, $operations) {
  if ($success) {
    if (!empty($results['errors'])) {
      foreach ($results['errors'] as $error) {
        drupal_set_message($error, 'error');
        \Drupal::logger('config_sync')->error($error);
      }
      drupal_set_message(\Drupal::translation()->translate('The configuration was imported with errors.'), 'warning');
    }
    else {
      drupal_set_message(\Drupal::translation()->translate('The configuration was imported successfully.'));
    }
  }
  else {
    // An error occurred.
    // $operations contains the operations that remained unprocessed.
    $error_operation = reset($operations);
    $message = \Drupal::translation()->translate('An error occurred while processing %error_operation with arguments: @arguments', array('%error_operation' => $error_operation[0], '@arguments' => print_r($error_operation[1], TRUE)));
    drupal_set_message($message, 'error');
  }
}
doc_Drupal
2016-10-29 08:54:35
Comments
Leave a Comment

Please login to continue.