You are here

protected function LingotekConfigManagementForm::getSelectedMappers in Lingotek Translation 3.4.x

Same name and namespace in other branches
  1. 8.2 src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSelectedMappers()
  2. 4.0.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSelectedMappers()
  3. 3.0.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSelectedMappers()
  4. 3.1.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSelectedMappers()
  5. 3.2.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSelectedMappers()
  6. 3.3.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSelectedMappers()
  7. 3.5.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSelectedMappers()
  8. 3.6.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSelectedMappers()
  9. 3.7.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSelectedMappers()
  10. 3.8.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSelectedMappers()

Gets the select mappers from their IDs.

Parameters

$values: Array of ids.

Return value

\Drupal\config_translation\ConfigNamesMapper[] The mappers.

3 calls to LingotekConfigManagementForm::getSelectedMappers()
LingotekConfigManagementForm::generateOperations in src/Form/LingotekConfigManagementForm.php
Generates an array of operations to be performed in a batch.
LingotekConfigManagementForm::redirectToAssignJobIdMultipleConfigForm in src/Form/LingotekConfigManagementForm.php
Redirect to assign Job ID form.
LingotekConfigManagementForm::redirectToClearJobIdMultipleConfigForm in src/Form/LingotekConfigManagementForm.php
Redirect to clear Job ID form.

File

src/Form/LingotekConfigManagementForm.php, line 1808

Class

LingotekConfigManagementForm
Form for bulk management of content.

Namespace

Drupal\lingotek\Form

Code

protected function getSelectedMappers($values) {
  $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::entityTypeManager()
      ->getStorage($this->filter)
      ->loadMultiple($values);
    foreach ($entities as $entity) {
      $mapper = clone $this->mappers[$this->filter];
      $mapper
        ->setEntity($entity);
      $mappers[$entity
        ->id()] = $mapper;
    }
  }
  return $mappers;
}