Skip to content

Commit

Permalink
Optimised content thumbnail resolving (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwojs authored Oct 31, 2024
1 parent 61a0914 commit 623bbc3
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,22 @@ public function getThumbnail(ContentType $contentType, array $fields, ?VersionIn
$fieldDefinitions = $contentType->getFieldDefinitions();

foreach ($fieldDefinitions as $fieldDefinition) {
$field = $this->getFieldByIdentifier($fieldDefinition->getIdentifier(), $fields);
if (!$fieldDefinition->isThumbnail()) {
continue;
}

$field = $this->getFieldByIdentifier($fieldDefinition->getIdentifier(), $fields);
if ($field === null) {
continue;
}

if (!$this->contentFieldStrategy->hasStrategy($field->getFieldTypeIdentifier())) {
continue;
}

$fieldType = $this->fieldTypeService->getFieldType($fieldDefinition->getFieldTypeIdentifier());

if (
$fieldDefinition->isThumbnail()
&& $this->contentFieldStrategy->hasStrategy($field->getFieldTypeIdentifier())
&& !$fieldType->isEmptyValue($field->getValue())
) {
if (!$fieldType->isEmptyValue($field->getValue())) {
return $this->contentFieldStrategy->getThumbnail($field, $versionInfo);
}
}
Expand Down

0 comments on commit 623bbc3

Please sign in to comment.