public static function updateVisibilityFinishedCallback($success, array $results, array $operations) {
    $messenger = \Drupal::messenger();
    if ($success) {
      // Here we could do something meaningful with the results.
      // We just display the number of nodes we processed...
      $messenger->addStatus(t('Visibility of @count content item(s) updated.', ['@count' => count($results)]));
    }
    else {
      // An error occurred.
      // $operations contains the operations that remained unprocessed.
      $error_operation = reset($operations);
      $messenger->addError(
        t('An error occurred while processing @operation with arguments : @args',
          [
            '@operation' => $error_operation[0],
            '@args' => print_r($error_operation[0], TRUE),
          ]
        )
      );
    }
  }
public static function updateVisibilityFinishedCallback($success, array $results, array $operations) {
    $messenger = \Drupal::messenger();
    if ($success) {
      // Here we could do something meaningful with the results.
      // We just display the number of nodes we processed...
      $messenger->addStatus(t('Visibility of @count content item(s) updated.', ['@count' => count($results)]));
    }
    else {
      // An error occurred.
      // $operations contains the operations that remained unprocessed.
      $error_operation = reset($operations);
      $messenger->addError(
        t('An error occurred while processing @operation with arguments : @args',
          [
            '@operation' => $error_operation[0],
            '@args' => print_r($error_operation[0], TRUE),
          ]
        )
      );
    }
  }
public static function updateVisibilityFinishedCallback ( $ success , array $ results , array $ operations ) { $ messenger = \ Drupal :: messenger ( ) ; if ( $ success ) { // Here we could do something meaningful with the results. // We just display the number of nodes we processed... $ messenger -> addStatus ( t ( 'Visibility of @count content item(s) updated.' , [ '@count' => count ( $ results ) ] ) ) ; } else { // An error occurred. // $operations contains the operations that remained unprocessed. $ error_operation = reset ( $ operations ) ; $ messenger -> addError ( t ( 'An error occurred while processing @operation with arguments : @args' , [ '@operation' => $ error_operation [ 0 ] , '@args' => print_r ( $ error_operation [ 0 ] , TRUE ) , ] ) ) ; } }
Callback for finished batch events.

@param bool $success
TRUE if the update was fully succeeded.
@param array $results
Contains individual results per operation.
@param array $operations
Contains the unprocessed operations that failed or weren't touched yet.
Callback for finished batch events .