#21257: Fixed empty snippets menu item issue.

The issue was that the snippets harvester included the Elements_Snippet shape which itself is not a snippet.
This also fixes an issue where it would not find snippets defined in the current theme.
This commit is contained in:
Sipke Schoorstra
2015-03-12 17:27:00 +01:00
parent 5a5318bc09
commit b6347a5de9

View File

@@ -40,7 +40,7 @@ namespace Orchard.Layouts.Providers {
public IEnumerable<ElementDescriptor> HarvestElements(HarvestElementsContext context) {
var currentThemeName = _siteThemeService.Value.GetCurrentThemeName();
var shapeTable = _shapeTableLocator.Value.Lookup(currentThemeName);
var shapeDescriptors = shapeTable.Descriptors.Where(x => x.Key.EndsWith(SnippetShapeSuffix, StringComparison.OrdinalIgnoreCase)).ToDictionary(x => x.Key, x => x.Value);
var shapeDescriptors = shapeTable.Bindings.Where(x => !String.Equals(x.Key, "Elements_Snippet", StringComparison.OrdinalIgnoreCase) && x.Key.EndsWith(SnippetShapeSuffix, StringComparison.OrdinalIgnoreCase)).ToDictionary(x => x.Key, x => x.Value.ShapeDescriptor);
var elementType = typeof (Snippet);
var snippetElement = _elementFactory.Value.Activate(elementType);