You are here

protected function BaseTmgmtActionApproveForm::getEntities in TMGMT Extension Suite 8.3

Same name and namespace in other branches
  1. 8 src/Form/BaseTmgmtActionApproveForm.php \Drupal\tmgmt_extension_suit\Form\BaseTmgmtActionApproveForm::getEntities()
  2. 8.2 src/Form/BaseTmgmtActionApproveForm.php \Drupal\tmgmt_extension_suit\Form\BaseTmgmtActionApproveForm::getEntities()

Returns saved entities.

Parameters

array $entity_ids: Entity ids.

Return value

array|\Drupal\Core\Entity\EntityInterface[] Returns array of loaded entities.

2 calls to BaseTmgmtActionApproveForm::getEntities()
BaseTmgmtActionApproveForm::buildForm in src/Form/BaseTmgmtActionApproveForm.php
Form constructor.
RequestTranslationTmgmtActionApproveForm::submitForm in src/Form/RequestTranslationTmgmtActionApproveForm.php
Form submit.

File

src/Form/BaseTmgmtActionApproveForm.php, line 130

Class

BaseTmgmtActionApproveForm
Provides a confirmation form for sending multiple content entities.

Namespace

Drupal\tmgmt_extension_suit\Form

Code

protected function getEntities(array $entity_ids) {
  $entities = [];
  $number_of_entity_types = count(array_unique(array_values($entity_ids)));
  if ($number_of_entity_types == 1) {
    $entity_type = array_values($entity_ids)[0];
    $ids = array_keys($entity_ids);
    $entities = $this->entityTypeManager
      ->getStorage($entity_type)
      ->loadMultiple($ids);
  }
  else {
    foreach ($entity_ids as $id => $ent_type) {
      $entities[] = $this->entityTypeManager
        ->getStorage($ent_type)
        ->load($id);
    }
  }
  return $entities;
}