You are here

protected function BlockFieldBlockContentImporter::importBlockContent in Entity Share 8.2

Helper function.

Parameters

\GuzzleHttp\Client $http_client: The HTTP client.

string $url: The URL to request to get the block content.

1 call to BlockFieldBlockContentImporter::importBlockContent()
BlockFieldBlockContentImporter::importBlockContentEntities in modules/entity_share_client/src/EventSubscriber/BlockFieldBlockContentImporter.php
Import block contents from block field.

File

modules/entity_share_client/src/EventSubscriber/BlockFieldBlockContentImporter.php, line 119

Class

BlockFieldBlockContentImporter
Class BlockFieldBlockContentImporter.

Namespace

Drupal\entity_share_client\EventSubscriber

Code

protected function importBlockContent(Client $http_client, $url) {
  $block_entity_response = $this->requestService
    ->request($http_client, 'GET', $url);
  $block_entity_json = Json::decode((string) $block_entity_response
    ->getBody());

  // $block_entity_json['data'] can be null in the case of
  // missing/deleted referenced entities.
  if (!isset($block_entity_json['errors']) && !is_null($block_entity_json['data'])) {
    $this->jsonapiHelper
      ->importEntityListData($block_entity_json['data']);
  }
}