Improve PlaceHolder API (BETA)

Found in

EPiServer.Forms 4.1.0

Fixed in

EPiServer.Forms 4.3.0


Nov 22, 2016


Feb 20, 2017




Closed, Acceptance tests pass


PlaceHolder is used in the Email Actor and RichText Element.

It is template of text, with placeholders like #NAME# #EMAIL#, where NAME is a field name of a form.
And, there are some extra predefined placeholders, like #SUMMARY#, that output a summary of all fields in form.


All available placeHolders are

  • FormElements of current Form (#FIELDNAME# placeholders will be replaced with actual submitted form values)
  • Predefined placeHolder (#SUMMARY#)
  • Extra placeHolder by 3rd party developer (provided by custom PlaceHolderProvider)

EditView UI might provide the combobox of available replaceable PlaceHolders, so the editor can choose a placeHolder easily. By default, The EmailActor and the RichTextElement have this combobox.

It is provided by this code


Customized PlaceHolder API

All processing of Placeholder is put in the PlaceHolderService (you can replace it with Dependency Injection - DI).
By default, it activates all instances IPlaceHolderProvider interface, and calls ProcessPlaceHolders().
PlaceHolderService calls available IPlaceHolderProviders in a chain of processing, by Order property. The latter provider is able to alter the previous provider result.

DefaultPlaceHolderProvider is the default implementation of IPlaceHolderProvider:

  • It replaces FormElementPlaceHolders with an actual value.
  • It provides an extra placeholder, #SUMMARY# .