Skip to content

Commit cb6e293

Browse files
committed
IBX-10289 Removed aggregations from getImageConfig() when content type has no matching field definition
1 parent 7ab7b9d commit cb6e293

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/lib/UI/Config/Provider/Module/DamWidget.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,17 @@ private function getImageConfig(): array
100100
{
101101
$imageConfig = [
102102
'showImageFilters' => $this->showImageFilters(),
103-
'aggregations' => $this->config['image']['aggregations'],
104103
'enableMultipleDownload' => extension_loaded('zip'),
105104
];
106105

106+
// The content type may not have the default fields; in that case, don't add the aggregations
107+
$imageType = $this->contentTypeService->loadContentTypeByIdentifier('image');
108+
foreach ($this->config['image']['aggregations'] as $aggregation) {
109+
if ($imageType->hasFieldDefinition($aggregation['fieldDefinitionIdentifier'])) {
110+
$imageConfig['aggregations'][] = $aggregation;
111+
}
112+
}
113+
107114
$mappings = [];
108115
$contentTypeIdentifiers = [];
109116
$fieldDefinitionIdentifiers = [];

0 commit comments

Comments
 (0)