Download & Extend

Allow Webform form location to be reordered through CCK field ordering

Project:Webform
Version:6.x-2.8
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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.

AttachmentSize
webform.module.patch340 bytes

Comments

#1

A better solution would be use hook_content_extra_fields_alter. Something like:

<?php
function 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

Status:needs work» reviewed & tested by the community

Tested cdale's recommendation and it worked great! I recommend that it be committed to webform. I've rolled a patch of the changes.

AttachmentSize
webform-field-weights.patch 511 bytes

#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

Version:6.x-2.6» 6.x-2.8
Category:bug report» feature request
Status:reviewed & tested by the community» fixed

Thanks, I cleaned up the documentation and comments and committed to the Drupal 6 2.x version.

AttachmentSize
webform_content_extra_fields.patch 833 bytes

#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

Title:"Description" aka body rendered below the form not above» Allow Webform form location to be reordered through CCK field ordering

#11

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.