protected function LingotekConfigManagementForm::generateOperations in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::generateOperations()
- 4.0.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::generateOperations()
- 3.0.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::generateOperations()
- 3.1.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::generateOperations()
- 3.2.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::generateOperations()
- 3.3.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::generateOperations()
- 3.4.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::generateOperations()
- 3.5.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::generateOperations()
- 3.6.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::generateOperations()
- 3.7.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::generateOperations()
- 3.8.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::generateOperations()
Generates an array of operations to be performed in a batch.
Parameters
string $operation: The operation (method of this object) to be executed.
array $values: The mappers this operation will be applied to.
$language: The language to be passed to that operation.
Return value
array An array of operations suitable for a batch.
2 calls to LingotekConfigManagementForm::generateOperations()
- LingotekConfigManagementForm::createBatch in src/
Form/ LingotekConfigManagementForm.php - Performs an operation to several values in a batch.
- LingotekConfigManagementForm::createDebugExportBatch in src/
Form/ LingotekConfigManagementForm.php - Create and set an export batch.
File
- src/
Form/ LingotekConfigManagementForm.php, line 1321 - Contains \Drupal\Lingotek\Form\LingotekConfigManagementForm.
Class
- LingotekConfigManagementForm
- Form for bulk management of content.
Namespace
Drupal\lingotek\FormCode
protected function generateOperations($operation, $values, $language) {
$operations = [];
$mappers = [];
if ($this->filter === 'config') {
foreach ($values as $value) {
$mappers[$value] = $this->mappers[$value];
}
}
elseif (substr($this->filter, -7) == '_fields') {
$mapper = $this->mappers[$this->filter];
$ids = \Drupal::entityQuery('field_config')
->condition('id', $values)
->execute();
$fields = FieldConfig::loadMultiple($ids);
$mappers = [];
foreach ($fields as $id => $field) {
$new_mapper = clone $mapper;
$new_mapper
->setEntity($field);
$mappers[$field
->id()] = $new_mapper;
}
}
else {
$entities = \Drupal::entityManager()
->getStorage($this->filter)
->loadMultiple($values);
foreach ($entities as $entity) {
$mapper = clone $this->mappers[$this->filter];
$mapper
->setEntity($entity);
$mappers[$entity
->id()] = $mapper;
}
}
foreach ($mappers as $mapper) {
$operations[] = [
[
$this,
$operation,
],
[
$mapper,
$language,
],
];
}
return $operations;
}