User login
Navigation
Recent blog posts
- Ubuntu mirrors up and improved!
- Google-jstemplate: Iterate object with unknown properties
- nginx https proxypass for php apps
- sugarcrm & memcache: Doing it Wrong
- subversion and https in Ubuntu Karmic
- Drupal: Views block delta converted to md5 hash
- Ubuntu Server install requires PAE
- Installing Drupal from command line
- Drupal: Handling form field weight through CCK
- minify javascript using Google Closure Compiler
angch's location
angch twitter
Drupal: Handling form field weight through CCK

kamal — Tue, 01/12/2009 - 16:23
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.
