It’s a common situation:
- Your templates are set up for multiple inheritance
- In more than one of these templates, you want to use the same field section and have the fields appear side-by-side
- You want to control the order the fields appear in the content editor
How do you go about setting this up?
- Create your templates, fields, and inheritance structure
- Ensure that the field sections are named exactly the same if you want their contained fields to be merged
- Ensure that the Sort Order field for all field sections that share a name are set identically
What’s the problem?
Sometimes, this doesn’t work. The fields seem to order themselves however they see fit. Often times this means all the fields from one template are mashed together at the top of the section, ignoring the meticulous sort order values you’ve set.
In the below example, I have three templates: Car Base, Sedan, and Truck. Sedan and Truck both inherit from Car Base.
All three templates’ Car Properties field sections have their Sort Order field values set to 100. The fields have the following sort orders:
- Car Base.Doors: 100
- Car Base.Engine Size: 200
- Sedan.Trunk Space: 150
- Truck.Towing Capacity: 150
For some reason, though, Trunk Space and Towing Capacity are showing up at the top of the Car Properties section when editing a sedan and truck, respectively. Based on the sort orders I listed above, this shouldn’t be happening…right?
How do I solve it?
Set the Sort Order values on each field section. Even if you want them all to be ‘100’, it is not enough to rely on the Sort Order field’s standard value. You must change it to something else, save it, change it back to 100, and save it again.
That means that this:
Which makes for happy developers and even happier editors.