This project is read-only.

Alternates for DynamicForms Elements?

Topics: Writing themes
Dec 28, 2015 at 5:55 PM
I'm working on implementing new themes in Orchard based on - no, not Bootstrap! Based on semantic-ui.

I had some difficulties, that I could solve with help of the documentation.

The problem I can't solve by myself is - how do I create alternates for dynamic form items? Like, let’s say, the CheckBox input field?

I can’t find out how to do it.
Dec 28, 2015 at 8:08 PM
All elements are rendered using the Element shape, so you could implement an IShapeTableProvider like this:
public class ElementShapeAlternates : IShapeTableProvider
    public void Discover(ShapeTableBuilder builder)
        builder.Describe("Element").OnDisplaying(context =>
            var element = (Element)context.Shape.Element;

            // TODO: Add your alternates here.
An example of an alternates provider can be found here:
That class adds an alternate based on the parent element's type so you can vary the shape templated based on that. Similarly, you'll have to define based on what data you want to add your alternates.