I think I had a problem related to http://drupal.org/node/280150

I needed to be able to re-order the blocks, similar to how View Reference works. With 6.x-1.14, you just get a single Select list, with the multiple attribute set. That doesn't allow for re-ordering (and doesn't match the other "ABC Reference" modules), which was a requirement for this project.

I used View Reference as a model and re-coded Block Reference to use the standard Select list with Multiple attribute. Autocomplete was not touched.

A patch for the fix is attached.

danielb, could you take a look at this?

Comments

puddyglum’s picture

Does my patch fix the block re-ordering correctly? If it's a correct fix then I'd like to update this module as many of our project use it. Thanks

danielb’s picture

It probably works but it also removes the existing widget method. It would be good if the two methods were separate.

puddyglum’s picture

StatusFileSize
new4.87 KB
new12.22 KB

I think that since the other "'XYZ' Reference" modules use the same kind of Select list (except for the current blockreference Select list), it seems reasonable to just use the one. To help clarify what the changes I made are, I've attached screenshots showing the before and after.

danielb’s picture

I think that since the other "'XYZ' Reference" modules use the same kind of Select list

OK I wasn't aware of that.

danielb’s picture

I think that since the other "'XYZ' Reference" modules use the same kind of Select list

All the evidence I have found suggest Block Reference is working consistently with User Reference and Node Reference.

Select lists do not support re-ordering.

Which version of the other reference modules are you claiming allow re-ordering?

The only difference I found was the #element_validate line should not be set explicitly but this should be done:

  if (empty($element[$field_key]['#element_validate'])) {
    $element[$field_key]['#element_validate'] = array();
  }
  array_unshift($element[$field_key]['#element_validate'], 'nodereference_optionwidgets_validate');
danielb’s picture

some more related reading

#585098: How to order item in select field ?
#234874: Setting the order of the nodes
#431270: Disallow re-ordering of node references
#406720: Allowing user to custom sort referenced nodes

I think it's a great idea to have the option available to do it, but I don't think that replacing the current method will bring it in line with the other reference modules, it will make it inconsistent with them.

danielb’s picture

Category: bug » feature
danielb’s picture

Status: Active » Fixed

I've added a second select method with the drag-and-drop sorting.

puddyglum’s picture

Awesome, will test it out

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

nvm, i found the option. sorry!
thanks for allowing this as an option.

emarchak’s picture

Version: 6.x-1.14 » 7.x-1.9
Status: Closed (fixed) » Active

I've run into this issue on the 7.x-1.9 version. I'm taking a stab at porting the patch over, but would appreciate any help.

danielb’s picture

Version: 7.x-1.9 » 6.x-1.14
Status: Active » Closed (fixed)

This issue was already fixed and included in the port to 7. If you are experiencing problems with it please start a new support request.