Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I needed to create a webform that contained more than twenty different components. Because sorting by the weights is obligatory, I couldn't get the 20+ components in the right order.
I request to increase the range of weights to at least something like (-20,20).
But because I couldn't find these numbers in the webform.module, I gathered that the range that is currently in use comes from Drupal itself. Therefore, I attacked the problem in another way by sorting the components by weight and then by name. In this way users can use a natural alphabetical ordering as well.
A patchfile is attached.
Comment | File | Size | Author |
---|---|---|---|
webform_0.patch | 1.41 KB | Anonymous (not verified) | |
Comments
Comment #1
jhriggs CreditAttribution: jhriggs commentedThe weight range can be changed with the optional fourth argument passed to the form_weight() function. Its default value is 10, giving the range -10 to 10. If you pass 20 for this, you will get -20 to 20. It may still be worthwhile to sort by weight then alphabetically as this patch does, though.
Comment #2
ullgren CreditAttribution: ullgren commentedNow the module sorts the components both by weight and name.
It also uses the number of components as the fourth parameter to form_weight() if the number of componenets are above 10
Comment #3
(not verified) CreditAttribution: commented