public static function FlowPull::batchFinished in CMS Content Sync 2.1.x
Same name and namespace in other branches
- 8 src/Controller/FlowPull.php \Drupal\cms_content_sync\Controller\FlowPull::batchFinished()
- 2.0.x src/Controller/FlowPull.php \Drupal\cms_content_sync\Controller\FlowPull::batchFinished()
Batch pull finished callback.
Parameters
$success:
$results:
$operations:
File
- src/
Controller/ FlowPull.php, line 276
Class
- FlowPull
- Pull controller.
Namespace
Drupal\cms_content_sync\ControllerCode
public static function batchFinished($success, $results, $operations) {
$failed = 0;
$empty = 0;
$synchronized = 0;
foreach ($results as $result) {
if ('FAILURE' == $result['type']) {
++$failed;
}
elseif ('EMPTY' == $result['type']) {
++$empty;
}
else {
$synchronized += $result['total'];
}
}
if ($failed) {
\Drupal::messenger()
->addMessage(t('Failed to pull from %failed entity pools.', [
'%failed' => $failed,
]));
}
if ($empty) {
\Drupal::messenger()
->addMessage(t('%empty entity pools were empty or had no new entities.', [
'%empty' => $empty,
]));
}
if ($synchronized) {
\Drupal::messenger()
->addMessage(t('%synchronized entities have been pulled.', [
'%synchronized' => $synchronized,
]));
}
}