You are here

protected function BaseTmgmtActionApproveForm::getEntities in TMGMT Extension Suite 8

Same name and namespace in other branches
  1. 8.3 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()
1 call to BaseTmgmtActionApproveForm::getEntities()
BaseTmgmtActionApproveForm::buildForm in src/Form/BaseTmgmtActionApproveForm.php
Form constructor.

File

src/Form/BaseTmgmtActionApproveForm.php, line 145

Class

BaseTmgmtActionApproveForm
Provides a confirmation form for sending multiple content entities.

Namespace

Drupal\tmgmt_extension_suit\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;
}