function devel_generate_batch_finished

Same name in other branches
  1. 7.x-1.x devel_generate/devel_generate_batch.inc \devel_generate_batch_finished()
  2. 4.x devel_generate/devel_generate.batch.inc \devel_generate_batch_finished()

Standard finish batch function.

3 string references to 'devel_generate_batch_finished'
BlockContentDevelGenerate::generateBatchContent in devel_generate/src/Plugin/DevelGenerate/BlockContentDevelGenerate.php
Generate content in batch mode.
ContentDevelGenerate::generateBatchContent in devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php
Generate content in batch mode.
MediaDevelGenerate::generateBatchMedia in devel_generate/src/Plugin/DevelGenerate/MediaDevelGenerate.php
Method for creating media when number of elements is greater than 50.

File

devel_generate/devel_generate.batch.inc, line 20

Code

function devel_generate_batch_finished($success, $results, $operations) {
    if ($success) {
        if (!empty($results['num_translations'])) {
            $message = t('Finished @num elements and @num_translations translations created successfully.', [
                '@num' => $results['num'],
                '@num_translations' => $results['num_translations'],
            ]);
        }
        else {
            $message = t('Finished @num elements created successfully.', [
                '@num' => $results['num'],
            ]);
        }
    }
    else {
        $message = t('Finished with an error.');
    }
    \Drupal::messenger()->addMessage($message);
}