initializeResultArray(); $fieldConfig = $this->data['parameterArray']['fieldConf']; $l10nDisplay = $fieldConfig['l10n_display'] ?? ''; $cropVariants = $fieldConfig['config']['cropVariants'] ?? ['default' => []]; $defaultLanguageRow = $this->data['defaultLanguageRow'] ?? null; if (!is_array($defaultLanguageRow) || !is_array($cropVariants) || $cropVariants === [] || $fieldConfig['config']['type'] !== 'imageManipulation' || GeneralUtility::inList($l10nDisplay, 'hideDiff') || GeneralUtility::inList($l10nDisplay, 'defaultAsReadonly') ) { return $result; } $html = []; $languages = [$defaultLanguageRow['language_tag'] => $defaultLanguageRow] + ($this->data['additionalLanguageRows'] ?? []); foreach ($languages as $sysLanguageUid => $languageRow) { $file = null; $fileUid = (int)($languageRow['uid_local'] ?? 0); if (!$fileUid) { continue; } try { $file = $this->resourceFactory->getFileObject($fileUid); } catch (FileDoesNotExistException|\InvalidArgumentException $e) { continue; } $processedImages = []; $cropVariantCollection = CropVariantCollection::create((string)($languageRow['crop'] ?? ''), $cropVariants); foreach (array_keys($cropVariants) as $variant) { $processedFileUrl = $file ->process( ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, [ 'maxWidth' => '145', 'maxHeight' => '45', 'crop' => $cropVariantCollection->getCropArea($variant)->makeAbsoluteBasedOnFile($file), ] ) ->getPublicUrl() ?? ''; if ($processedFileUrl !== '') { $processedImages[] = ' 'lazy', 'src' => $processedFileUrl, 'alt' => $languageRow['alternative'] ?? $file->getProperty('alternative') ?? '', 'title' => $languageRow['title'] ?? $file->getProperty('title') ?? '', ], true) . ' />'; } } if ($processedImages !== []) { $iconIdentifier = $this->data['systemLanguageRows'][(int)$sysLanguageUid]['flagIconIdentifier'] ?? 'flags-multiple'; $html[] = '
'; $html[] = $this->iconFactory->getIcon($iconIdentifier, IconSize::SMALL)->render(); $html[] = implode(LF, $processedImages); $html[] = '
'; } } $result['html'] = implode(LF, $html); return $result; } }