public static function PhotosDirectoryImportForm::finishedMovingImageFiles in Album Photos 8.5
Same name and namespace in other branches
- 6.0.x src/Form/PhotosDirectoryImportForm.php \Drupal\photos\Form\PhotosDirectoryImportForm::finishedMovingImageFiles()
Finished batch operation moving image files.
Parameters
bool $success: Indicates whether the batch process was successful.
array $results: Results information passed from the processing callback.
File
- src/Form/ PhotosDirectoryImportForm.php, line 383 
Class
- PhotosDirectoryImportForm
- Defines a form to upload photos to this site.
Namespace
Drupal\photos\FormCode
public static function finishedMovingImageFiles($success, array $results) {
  // Clear node and album page cache.
  Cache::invalidateTags([
    'node:' . $results['nid'],
    'photos:album:' . $results['nid'],
  ]);
  // Update count.
  PhotosAlbum::setCount('user_image', $results['uid']);
  PhotosAlbum::setCount('node_album', $results['nid']);
  if ($success) {
    if ($results['copy']) {
      $message = \Drupal::translation()
        ->formatPlural($results['images_processed'], 'One image copied to selected album.', '@count images copied to selected album.');
    }
    else {
      $message = \Drupal::translation()
        ->formatPlural($results['images_processed'], 'One image moved to selected album.', '@count images moved to selected album.');
    }
  }
  else {
    $message = t('Finished with an error.');
  }
  \Drupal::messenger()
    ->addMessage($message);
}