Skip to content

Commit

Permalink
feat: Added editor alias to BasicBlockListModel
Browse files Browse the repository at this point in the history
  • Loading branch information
nikcio committed Apr 25, 2022
1 parent a376d66 commit da7c885
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,20 @@ public class BasicBlockListModel<T> : PropertyValue
[GraphQLDescription("Gets the blocks of a block list model.")]
public virtual List<T>? Blocks { get; set; }

/// <summary>
/// Gets the editor alias of the block list model
/// </summary>
[GraphQLDescription("Gets the editor alias of the block list model.")]
public virtual string EditorAlias { get; set; }

/// <inheritdoc/>
public BasicBlockListModel(CreatePropertyValue createPropertyValue, IDependencyReflectorFactory dependencyReflectorFactory) : base(createPropertyValue) {
var value = (BlockListModel) createPropertyValue.Property.GetValue();
Blocks = value?.Select(blockListItem => {
var type = typeof(T);
return dependencyReflectorFactory.GetReflectedType<T>(type, new object[] { new CreateBlockListItem(createPropertyValue.Content, blockListItem, createPropertyValue.Culture) });
}).OfType<T>().ToList();
EditorAlias = createPropertyValue.Property.PropertyType.EditorAlias;
}
}
}

0 comments on commit da7c885

Please sign in to comment.