mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Fixing multiple drivers per element issue.
This issue fixes an issue where multiple drivers for the same element type would throw an exception due to the element type being present more than once in the element type repository.
This commit is contained in:
@@ -20,7 +20,12 @@ namespace Orchard.Layouts.Providers {
|
||||
|
||||
public IEnumerable<ElementDescriptor> HarvestElements(HarvestElementsContext context) {
|
||||
var drivers = _elementManager.Value.GetDrivers();
|
||||
var elementTypes = drivers.Select(x => x.GetType().BaseType.GenericTypeArguments[0]).Where(x => !x.IsAbstract && !x.IsInterface).ToArray();
|
||||
var elementTypes = drivers
|
||||
.Select(x => x.GetType().BaseType.GenericTypeArguments[0])
|
||||
.Where(x => !x.IsAbstract && !x.IsInterface)
|
||||
.Distinct()
|
||||
.ToArray();
|
||||
|
||||
return elementTypes.Select(elementType => {
|
||||
var element = _factory.Value.Activate(elementType);
|
||||
return new ElementDescriptor(elementType, element.Type, element.DisplayText, element.Category) {
|
||||
|
Reference in New Issue
Block a user