You are here

protected function InstallHelper::processBannerBlock in Drupal 10

Same name and namespace in other branches
  1. 8 core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php \Drupal\demo_umami_content\InstallHelper::processBannerBlock()
  2. 9 core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php \Drupal\demo_umami_content\InstallHelper::processBannerBlock()

Process block_banner data into block_banner block structure.

Parameters

array $data: Data of line that was read from the file.

string $langcode: Current language code.

Return value

array Data structured as a block.

File

core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php, line 576

Class

InstallHelper
Defines a helper class for importing default content.

Namespace

Drupal\demo_umami_content

Code

protected function processBannerBlock(array $data, $langcode) {
  $node_url = $this
    ->getNodePath($langcode, $data['content_type'], $data['node_id']);
  $values = [
    'uuid' => $data['uuid'],
    'info' => $data['info'],
    'type' => $data['type'],
    'langcode' => 'en',
    'field_title' => [
      'value' => $data['field_title'],
    ],
    'field_content_link' => [
      'uri' => 'internal:/' . $langcode . '/' . $node_url,
      'title' => $data['field_content_link_title'],
    ],
    'field_summary' => [
      'value' => $data['field_summary'],
    ],
    'field_media_image' => [
      'target_id' => $this
        ->getMediaImageId($data['image_reference']),
    ],
  ];
  return $values;
}