You are here

public static function Watermark::batchCreateImage in Media watermark 8

Batch worker function.

Need to be in global visibility.

Parameters

\Drupal\file\Entity\File $file: File entity object.

\Drupal\media_watermark\Entity\MediaWatermark $watermark: MediaWatermark entity object.

array $context: Batch API context array.

See also

media_watermark_batch_submit()

File

src/Watermark/Watermark.php, line 205

Class

Watermark
Custom watermark class.

Namespace

Drupal\media_watermark\Watermark

Code

public static function batchCreateImage(File $file, MediaWatermark $watermark, array &$context) {
  self::createImage($file, $watermark, 'edit');
  $context['results'][] = $file
    ->id() . ' : ' . Html::escape($file
    ->getFilename());

  // Optional message displayed under the progressbar.
  $context['message'] = t('Loading node "@title"', [
    '@title' => $file
      ->getFilename(),
  ]);
  $_SESSION['http_request_count']++;
}