0
votes

I have Custom Content Type in Orchard, with coresponding part of same name with two text fields, defined in migrations. The part definition is as follows:

ContentDefinitionManager.AlterPartDefinition("Faq",
           cfg => cfg
               .Attachable()
               .WithField("Question", f => f
                   .OfType("TextField")
                   .WithDisplayName("Question")
                   .WithSetting("Flavor","Wide"))
               .WithField("Answer", f => f
                   .OfType("TextField")
                   .WithDisplayName("Answer")
                   .WithSetting("Flavor", "Html"))

This adds the fields to the part, but the setting is not applied - both fields have the default flavor in the dashboard. I believe it is just a silly typo but I'm unable to figure it out.

1
It might be that it is case sensitive. Try "html" instead of "Html"devqon

1 Answers

1
votes

Yeah, adding fields in migrations can be a little fiddly. What you really need is instead of just "Flavor", you need its fully qualified name, "TextFieldSettings.Flavor".

I've actually started adding a feature to Orchardizer (a VS extension) that will transform your export code into migrations code, so it'll build all that stuff for you. Should be done by the weekend (if I don't start feeling lazy)