Allow Webform form location to be reordered through CCK field ordering
omo - March 25, 2009 - 19:32
| Project: | Webform |
| Version: | 6.x-2.8 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
In my setup (including CCK) the description of a webform is rendered below the form not above. I did not find another solution but to change the weight of the $node->content['webform'] field to make sure it's higher than any other cck field. This should be clearly fixed more properly by the module itself by assigning a weight according the weight of the other node fields. The attached patch should help in most cases for the meantime.
| Attachment | Size |
|---|---|
| webform.module.patch | 340 bytes |

#1
A better solution would be use hook_content_extra_fields_alter. Something like:
<?phpfunction webform_content_extra_fields_alter(&$extra, $type_name) {
if ($type_name == 'webform') {
$extra['webform'] = array(
'label' => t('Webform'),
'description' => t('webform display'),
'weight' => 1,
);
}
}
?>
I haven't actually tested this code myself, but I've done something similar in other modules. This way, you can adjust the weight on the webform content type page via CCK.
#2
I agree, cdale's approach would be preferable if we're going to be making changes to the weights.
#3
Thank You, CDALE!
Tested and works smoothly.
#4
Tested cdale's recommendation and it worked great! I recommend that it be committed to webform. I've rolled a patch of the changes.
#5
This is extremely useful! Thank you!
#6
Wow, I didn't knew there's such a elegant solution. Thanks cdale.
#7
I think I'm missing something obvious.
With cdale's above code in template.php, where should I be able to set the weight of that field?
#8
Thanks, I cleaned up the documentation and comments and committed to the Drupal 6 2.x version.
#9
jkristos, This is a change to the module file, not to your theme. After applying the patch, you can reorder the field through CCK's interface for ordering fields at admin/content/node-type/webform/fields.
#10
#11
Automatically closed -- issue fixed for 2 weeks with no activity.