Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 299191

block.js shouldn't check for select.block-weight because weight elements can be textfields

$
0
0

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.


Viewing all articles
Browse latest Browse all 299191

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>