2024-03-15 17:02:56 +02:00

15 lines
473 B
Plaintext

private function getImages(NodeInterface $node, string $field): array {
$images = [];
foreach ($node->get($field)->getValue() as $value) {
$file = $this->entityTypeManager
->getStorage('file')
->load($value['target_id']);
if ($file) {
$url = $this->fileUrlGenerator
->generateAbsoluteString($file->getFileUri());
$images[] = array("url" => $url, "alt" => $value['alt']);
}
}
return $images;
}