Drupal: Handling form field weight through CCK

If you have custom field added to the node form (probably using hook_form_alter), you have to manually set the #weight properties to order the element the way you want on the node form. CCK user definitely would miss the 'drag and drop' UI to rearrange CCK fields.
Turn out it possible to somehow 'register' your custom fields so that it can be rearranged using the CCK UI. Cool. I first found this in an old issue queue. Further 'googling' lead me to this blog post which describe it further.
The key is the hook_content_extra_fields that you can implement to return an array of fields to be managed by CCK. Then function content_extra_field_weight($node_type, $fieldname) can be use to set the weight properties on hook_view or hook_nodeapi view op.
- Tags:

