public static function TreeRebuilder::batchFinished in Entity Reference Hierarchy 3.x
Same name and namespace in other branches
- 8.2 src/Storage/TreeRebuilder.php \Drupal\entity_hierarchy\Storage\TreeRebuilder::batchFinished()
File
- src/
Storage/ TreeRebuilder.php, line 144
Class
- TreeRebuilder
- Defines a class for rebuilding the tree.
Namespace
Drupal\entity_hierarchy\StorageCode
public static function batchFinished($success, $results, $operations) {
//@codingStandardsIgnoreEnd
if ($success) {
// Here we do something meaningful with the results.
$message = new TranslatableMarkup('Finished rebuilding tree, @count items were processed.', [
'@count' => count($results),
]);
\Drupal::messenger()
->addMessage($message);
}
else {
// An error occurred.
// $operations contains the operations that remained unprocessed.
$error_operation = reset($operations);
$message = new TranslatableMarkup('An error occurred while processing %error_operation with arguments: @arguments', [
'%error_operation' => implode('::', $error_operation[0]),
'@arguments' => print_r($error_operation[1], TRUE),
]);
\Drupal::messenger()
->addMessage($message, 'error');
}
}