You are here

public function StateInformation::getImportStatusByParameters in Entity Share 8.3

Gets the dedicated "Entity import status" entity for given parameters.

Parameters

string $uuid: UUID.

string $entity_type_id: Entity type identifier.

string|null $langcode: Language code.

Return value

\Drupal\entity_share_client\Entity\EntityImportStatusInterface|bool The "Entity import status" entity or FALSE if none found.

Overrides StateInformationInterface::getImportStatusByParameters

1 call to StateInformation::getImportStatusByParameters()
StateInformation::getImportStatusOfEntity in modules/entity_share_client/src/Service/StateInformation.php
Gets the dedicated "Entity import status" entity for imported entity.

File

modules/entity_share_client/src/Service/StateInformation.php, line 273

Class

StateInformation
Service to handle presentation of import state.

Namespace

Drupal\entity_share_client\Service

Code

public function getImportStatusByParameters(string $uuid, string $entity_type_id, string $langcode = NULL) {

  // A content entity can be uniquely identified by entity type, UUID and
  // language code (if entity type supports languages).
  $search_criteria = [
    'entity_uuid' => $uuid,
    'entity_type_id' => $entity_type_id,
  ];
  if ($langcode) {
    $search_criteria['langcode'] = $langcode;
  }

  /** @var \Drupal\entity_share_client\Entity\EntityImportStatusInterface[] $import_status_entities */
  $entity_storage = $this->entityTypeManager
    ->getStorage('entity_import_status');
  $import_status_entities = $entity_storage
    ->loadByProperties($search_criteria);
  if (!empty($import_status_entities)) {
    return current($import_status_entities);
  }
  return FALSE;
}