how do you modify the weight range from the default 10 -> -10 to something like 40 -> -40? i specificly need to do this for the webform module. thanks!

Comments

starflyer’s picture

...

luti’s picture

It seems to me that it is enough to change the '#delta' parameter in the system.module file.

So, replace the number 10 in the line 77 of the file 'modules/system.module':

instead of:
$type['weight'] = array('#input' => TRUE, '#delta' => 10, '#default_value' => 0);
it shall be:
$type['weight'] = array('#input' => TRUE, '#delta' => 120, '#default_value' => 0);
(or, any other number, as you need it...)

I've replaced the value 10 with the value 120 (if you check the database, it is stored into the TINY_INT field, so the maximum shall be 127) and it seems to work fine. I've just successfully entered some terms, and until now, it doesn't seem to create any problems.

I wonder why the default is so low (+10 to -10 only; it doesn't seem to me that it is much more problematic to select among 240 items now, as it is not done very often...) and why there is no setting in config file or at least in the database, so a system file has to be patched if you need more terms (as I do).

If somebody is aware of any issue that can arise due to the change I've made, I would appreciate to warn me before I do much more work in this direction (= ASAP). Thank you in advance.

Regards,

LUTi

paacific’s picture

It works and its easy too (i was looking for a module for this).

nvl.sateesh’s picture

Drupal 7

Just in case someone is looking for the same issue in Drupal 7, you don't need to hack system.module. Simply implement hook_element_info_alter(), which worked for me.

Example:

function EXAMPLE_element_info_alter(&$type){
  // Increase the default weight range
  if (isset($type['weight']['#delta'])) {
    $type['weight']['#delta'] = 120;
  }    
}

Sateesh Nutulapati
Devops Solutions Architect at New Target, Inc.