Reputation: 75
How do i reorder fields that inherited from an existing behavior within a fields definition that i wrote my self. For example I want to use the leadimage field (behavior) from plone.app.contenttypes but instead of having it at the bottom of all fields i defined, i want to have it after the description.
I've tried like this:
<property name="model_source">
<model xmlns:security="http://namespaces.plone.org/supermodel/security"
xmlns:marshal="http://namespaces.plone.org/supermodel/marshal"
xmlns:form="http://namespaces.plone.org/supermodel/form"
xmlns="http://namespaces.plone.org/supermodel/schema">
<schema>
<field name="image" type="plone.namedfile.field.NamedBlobImage" form:after="description">
<title>Image</title>
</field>
</schema>
</model>
</property>
and btw. is there a more readable way to do this?
Upvotes: 1
Views: 232
Reputation: 75
form.order_after(image1='ILeadImage.image')
that did the trick, was a little confused within the code example...
followup question: if i have 3 image field with each having a caption field, do i really have to add that line to every field itself? or is there a way to set the order for all fields in one place like with the fieldset definition?
Upvotes: 2
Reputation: 2876
I never have tried this using XML but the Dexterity XML documentation says it's possible; check the after/before attributes.
I think you can have more control using Python code; check the Form schema hints documentation.
Upvotes: 1