protected function LingotekManagementForm::createBatch in Lingotek Translation 8
Performs an operation to several values in a batch.
Parameters
string $operation: The method in this object we need to call.
array $values: Array of ids to process.
string $title: The title for the batch progress.
string $language: The language code for the request. NULL if is not applicable.
10 calls to LingotekManagementForm::createBatch()
- LingotekManagementForm::createChangeProfileBatch in src/
Form/ LingotekManagementForm.php - Create and set a profile change batch.
- LingotekManagementForm::createDisassociateBatch in src/
Form/ LingotekManagementForm.php - Create and set a disassociate batch.
- LingotekManagementForm::createDownloadBatch in src/
Form/ LingotekManagementForm.php - Create and set a request target and download batch for all languages.
- LingotekManagementForm::createLanguageDownloadBatch in src/
Form/ LingotekManagementForm.php - Create and set a request target and download batch for a given language.
- LingotekManagementForm::createLanguageRequestTranslationBatch in src/
Form/ LingotekManagementForm.php - Create and set a request translations batch for all languages.
File
- src/
Form/ LingotekManagementForm.php, line 483 - Contains \Drupal\Lingotek\Form\LingotekManagementForm.
Class
- LingotekManagementForm
- Form for bulk management of content.
Namespace
Drupal\lingotek\FormCode
protected function createBatch($operation, $values, $title, $language = NULL) {
$operations = [];
$entities = $this->entityManager
->getStorage($this->entityTypeId)
->loadMultiple($values);
foreach ($entities as $entity) {
$operations[] = [
[
$this,
$operation,
],
[
$entity,
$language,
],
];
}
$batch = array(
'title' => $title,
'operations' => $operations,
'finished' => [
$this,
'batchFinished',
],
'progressive' => TRUE,
'batch_redirect' => $this
->getRequest()
->getUri(),
);
batch_set($batch);
}