You are here

protected function EntityReference::importUrl in Entity Share 8.3

Helper function.

Parameters

\Drupal\entity_share_client\RuntimeImportContext $runtime_import_context: The runtime import context.

string $url: The URL to import.

Return value

array The list of entity IDs imported keyed by UUIDs.

4 calls to EntityReference::importUrl()
BlockFieldBlockContentImporter::importUrl in modules/entity_share_client/src/Plugin/EntityShareClient/Processor/BlockFieldBlockContentImporter.php
Helper function.
EmbeddedEntityImporter::parseFormattedTextAndImport in modules/entity_share_client/src/Plugin/EntityShareClient/Processor/EmbeddedEntityImporter.php
Parse text to import embedded entities.
EntityReference::processEntity in modules/entity_share_client/src/Plugin/EntityShareClient/Processor/EntityReference.php
Method called on STAGE_PROCESS_ENTITY.
LinkInternalContentImporter::processLink in modules/entity_share_client/src/Plugin/EntityShareClient/Processor/LinkInternalContentImporter.php
Attempts to import UUID-enhanced link content.
1 method overrides EntityReference::importUrl()
BlockFieldBlockContentImporter::importUrl in modules/entity_share_client/src/Plugin/EntityShareClient/Processor/BlockFieldBlockContentImporter.php
Helper function.

File

modules/entity_share_client/src/Plugin/EntityShareClient/Processor/EntityReference.php, line 242

Class

EntityReference
Handle entity reference.

Namespace

Drupal\entity_share_client\Plugin\EntityShareClient\Processor

Code

protected function importUrl(RuntimeImportContext $runtime_import_context, $url) {
  $referenced_entities_ids = [];
  $referenced_entities_response = $this->remoteManager
    ->jsonApiRequest($runtime_import_context
    ->getRemote(), 'GET', $url);
  $referenced_entities_json = Json::decode((string) $referenced_entities_response
    ->getBody());

  // $referenced_entities_json['data'] can be null in the case of
  // missing/deleted referenced entities.
  if (!isset($referenced_entities_json['errors']) && !is_null($referenced_entities_json['data'])) {
    $this->currentRecursionDepth++;
    $referenced_entities_ids = $runtime_import_context
      ->getImportService()
      ->importEntityListData($referenced_entities_json['data']);
    $this->currentRecursionDepth--;
  }
  return $referenced_entities_ids;
}