I have a custom module which ultimately creates a node of a given type. It gets the fields of that node type and creates my own form with them, HOWEVER, it does not preserve that node's order of fields.
I can do it manually, but would prefer to follow one of the display mode's configuration, like 'view' or 'form'
How can I access the field weights in PHP?