Skip to content

Commit 76216b9

Browse files
authored
Only get definitions of provided contained types (#13891)
1 parent 5d88a0e commit 76216b9

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/OrchardCore.Modules/OrchardCore.Lists/Drivers/ContainedPartDisplayDriver.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,10 @@ private IDisplayResult GetListPartHeader(string containerId, ListPartSettings li
164164
}).Location("Content:1");
165165
}
166166

167-
private IEnumerable<ContentTypeDefinition> GetContainedContentTypes(ListPartSettings settings)
168-
{
169-
var contentTypes = settings.ContainedContentTypes ?? Enumerable.Empty<string>();
170-
171-
if (!contentTypes.Any())
172-
{
173-
return Enumerable.Empty<ContentTypeDefinition>();
174-
}
175-
176-
return _contentDefinitionManager.ListTypeDefinitions().Where(x => contentTypes.Contains(x.Name));
177-
}
167+
private IEnumerable<ContentTypeDefinition> GetContainedContentTypes(ListPartSettings settings) =>
168+
settings.ContainedContentTypes
169+
?.Select(contentType => _contentDefinitionManager.GetTypeDefinition(contentType))
170+
.Where(definition => definition is not null)
171+
?? Enumerable.Empty<ContentTypeDefinition>();
178172
}
179173
}

0 commit comments

Comments
 (0)