Drupal has a weight
form element type. Very useful. Its output is sometimes a select
and sometimes a textfield
.
That weight element is used on the blocks admin page:
$form['blocks'][$key]['weight'] = array(
'#type' => 'weight',
'#default_value' => $block['weight'],
'#delta' => $weight_delta,
'#title_display' => 'invisible',
'#title' => t('Weight for @block block', array('@block' => $block['info'])),
);
so they're not necessarily select
elements. block.js
doesn't care:
var weightField = $('select.block-weight', dragObject.rowObject.element);
The "select"
in the selector is completely redundant, and plain wrong, so the fix couldn't be easier: remove it. Now it works for weight textfields too.
Reproducing is simple:
1. $ drush vset drupal_weight_select_max 0
2. Go to the blocks overview admin page.
3. Drag blocks around. You will get JS errors, because the weight element can't be found.