You are here

protected function SendContextActionApproveForm::getEntities in TMGMT Translator Smartling 8

Same name and namespace in other branches
  1. 8.4 src/Form/SendContextActionApproveForm.php \Drupal\tmgmt_smartling\Form\SendContextActionApproveForm::getEntities()
  2. 8.2 src/Form/SendContextActionApproveForm.php \Drupal\tmgmt_smartling\Form\SendContextActionApproveForm::getEntities()
  3. 8.3 src/Form/SendContextActionApproveForm.php \Drupal\tmgmt_smartling\Form\SendContextActionApproveForm::getEntities()
1 call to SendContextActionApproveForm::getEntities()
SendContextActionApproveForm::buildForm in src/Form/SendContextActionApproveForm.php
Form constructor.

File

src/Form/SendContextActionApproveForm.php, line 145

Class

SendContextActionApproveForm
Provides a confirmation form for sending multiple content entities.

Namespace

Drupal\tmgmt_smartling\Form

Code

protected function getEntities(array $entityIds) {
  $entities = [];
  $number_of_entity_types = count(array_unique(array_values($entityIds)));
  if ($number_of_entity_types == 1) {
    $entity_type = array_values($entityIds)[0];
    $ids = array_keys($entityIds);

    /** @var \Drupal\node\NodeInterface[] $nodes */
    $entities = $this->entityTypeManager
      ->getStorage($entity_type)
      ->loadMultiple($ids);
  }
  else {
    foreach ($entityIds as $id => $ent_type) {
      $entities[] = $this->entityTypeManager
        ->getStorage($ent_type)
        ->load($id);
    }
  }
  return $entities;
}