You are here

protected function LingotekJobAssignToMultipleEntitiesForm::getSelectedEntities in Lingotek Translation 8.2

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

Gets an array as in $entity_type_id:$id => $entity from the selection.

Parameters

string[][] $selection: The selection.

Return value

\Drupal\Core\Entity\ContentEntityInterface[] The entities.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

2 calls to LingotekJobAssignToMultipleEntitiesForm::getSelectedEntities()
LingotekJobAssignToMultipleEntitiesForm::buildForm in src/Form/LingotekJobAssignToMultipleEntitiesForm.php
Form constructor.
LingotekJobAssignToMultipleEntitiesForm::submitForm in src/Form/LingotekJobAssignToMultipleEntitiesForm.php
Form submission handler.

File

src/Form/LingotekJobAssignToMultipleEntitiesForm.php, line 238

Class

LingotekJobAssignToMultipleEntitiesForm
Form for bulk assignation of Job ID to content entities.

Namespace

Drupal\lingotek\Form

Code

protected function getSelectedEntities($selection) {
  $entities = [];
  foreach ($selection as $entity_type_id => $ids) {
    $list = $this->entityTypeManager
      ->getStorage($entity_type_id)
      ->loadMultiple(array_keys($ids));
    foreach ($list as $id => $entity) {
      $key = $entity_type_id . ':' . $id;
      $entities[$key] = $entity;
    }
  }
  return $entities;
}