[development] Weight values function?

Doug Green douggreen at douggreenconsulting.com
Mon Dec 24 15:43:37 UTC 2007

Weights are used in several places, and always as an integer, I don't
think that there is anything that restricts it from -10 to 10.

Drupal core does it by using the 'type' => '#weight'.  See


Also look at process_weight in includes/form.inc.

I'm not really sure why it's done this way.  I would of simply used: 
'#type' => 'select', '#options' => drupal_map_assoc(range(-10, 10))

Alessandro Feijó wrote:
> There is in drupal core a function to return the #options to my weight fields? (-10 to 10, i.e.)
> I'm searching in the \includes folder, without success :)
> Thanks
> Feijó

More information about the development mailing list