Skip to content

Commit

Permalink
fix: Add culture to basic block list getValue
Browse files Browse the repository at this point in the history
fixes #91
  • Loading branch information
nikcio committed Oct 5, 2022
1 parent ebd25bb commit 04db15f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class BasicBlockListModel<TBlockListItem> : PropertyValue

/// <inheritdoc/>
public BasicBlockListModel(CreatePropertyValue createPropertyValue, IDependencyReflectorFactory dependencyReflectorFactory) : base(createPropertyValue) {
var propertyValue = createPropertyValue.Property.GetValue();
var propertyValue = createPropertyValue.Property.GetValue(createPropertyValue.Culture);
if (propertyValue == null) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ public class BasicNestedContent<TNestedContentElement> : PropertyValue

/// <inheritdoc/>
public BasicNestedContent(CreatePropertyValue createPropertyValue, IDependencyReflectorFactory dependencyReflectorFactory) : base(createPropertyValue) {
var elements = (createPropertyValue.Property.GetValue() as IEnumerable<IPublishedElement>)?.ToList();
if (elements == null) {
var propertyValue = createPropertyValue.Property.GetValue(createPropertyValue.Culture);
if (propertyValue == null) {
return;
}

Elements = elements.Select(element => {
var value = (IEnumerable<IPublishedElement>) propertyValue;
Elements = value?.Select(element => {
var type = typeof(TNestedContentElement);
return dependencyReflectorFactory.GetReflectedType<TNestedContentElement>(type, new object[] { new CreateNestedContentElement(createPropertyValue.Content, element, createPropertyValue.Culture) });
}).OfType<TNestedContentElement>().ToList();
Expand Down

0 comments on commit 04db15f

Please sign in to comment.