Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Structure items order by Alias - broken when Export On Save #44

Merged
merged 1 commit into from
Sep 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,18 @@ protected virtual void SerializeExtraProperties(XElement node, TObject item, Pro
protected XElement SerializeStructure(TObject item)
{
var node = new XElement("Structure");

foreach (var allowedType in item.AllowedContentTypes.OrderBy(x => x.Alias))
List<KeyValuePair<string, string>> items = new List<KeyValuePair<string, string>>();

foreach (var allowedType in item.AllowedContentTypes)
{
var allowedItem = FindItem(allowedType.Id.Value);
if (allowedItem != null)
{
node.Add(new XElement(ItemType, new XAttribute("Key", allowedItem.Key.ToString()), allowedItem.Alias));
items.Add(new KeyValuePair<string, string>(allowedItem.Key.ToString(), allowedItem.Alias));
}
}

if (items.Count > 0)
node.Add(items.OrderBy(x => x.Value).Select(x => new XElement(ItemType, new XAttribute("Key", x.Key), x.Value)).ToArray());
return node;
}

Expand Down