Posts

Showing posts from December, 2018

Get Specific Elements Blocks from EPiServer Forms

A small extension to get the specific form elements block with all properties rather relying on  FriendlyNameInfo with the limited set of properties.
EPi Form Extensions Gist
Example: Custom form element block: publicclassHiddenExternalValueElementBlock : HiddenElementBlockBase {     [Display(Name = "Enable if its a special campaign")]     publicvirtualbool MySpecialCampaign { get; set; }    [Display(Name = "Propperty 1")]     publicvirtualbool Property1 { get; set; }    [Display(Name = "Property 2")]     publicvirtualbool Property2 { get; set; } }
Extension Methods:
using EPiServer.Core; using EPiServer.Forms.Core; using EPiServer.Forms.Core.Models; using EPiServer.Forms.Helpers.Internal; using EPiServer.Forms.Implementation.Elements; using System.Collections.Generic; using System.Linq; namespace PixieDigital.EpiServer.Extensions {     publicstaticclassFormExtensions     {         publicstaticIEnumerable<T> GetSpecificFormElements<T>(thisForm…