You are here

public function ViewsBulkOperationsActionProcessor::getEntity in Views Bulk Operations (VBO) 8

Get entity for processing.

Parameters

array $entity_data: Entity data array.

Overrides ViewsBulkOperationsActionProcessorInterface::getEntity

1 call to ViewsBulkOperationsActionProcessor::getEntity()
ViewsBulkOperationsActionProcessor::populateQueue in src/Service/ViewsBulkOperationsActionProcessor.php
Populate entity queue for processing.

File

src/Service/ViewsBulkOperationsActionProcessor.php, line 360

Class

ViewsBulkOperationsActionProcessor
Defines VBO action processor.

Namespace

Drupal\views_bulk_operations\Service

Code

public function getEntity(array $entity_data) {
  if (!isset($entity_data[4])) {
    $entity_data[4] = FALSE;
  }
  list(, $langcode, $entity_type_id, $id, $revision_id) = $entity_data;

  // Load the entity or a specific revision depending on the given key.
  $entityStorage = $this->entityTypeManager
    ->getStorage($entity_type_id);
  $entity = $revision_id ? $entityStorage
    ->loadRevision($revision_id) : $entityStorage
    ->load($id);
  if ($entity instanceof TranslatableInterface) {
    $entity = $entity
      ->getTranslation($langcode);
  }
  return $entity;
}