I cannot reorder the conditionals. Before I save, they appear OK, but after I save, they are always the old order.

And "show row weights" does not show anything, instead it just hides the move arrows.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

I've noticed this problem too. Thanks for opening an official issue.

fenstrat’s picture

Title: Conditionals Reordering » Conditionals reordering not working
Version: 7.x-4.0-alpha3 » 7.x-4.x-dev
Status: Active » Needs review
FileSize
5.13 KB

Attached patch fixes reordering not working.

  1. Changes the weight feild from #type hidden to weight.
  2. Moves weight column to last, because if it's first core's "Hide/Show row weights" doesn't work.
  3. Changes the orderBy() clause on conditionals in hook_node_load() to be weight, not rgid.
quicksketch’s picture

Thanks @fenstrat! The code went through a few iterations where order was not relevant which is how we ended up in this situation. I'll review the patch when I get a chance.

fenstrat’s picture

No worries @quicksketch, look forward to the review.

fenstrat’s picture

Update to #2 which used the incorrect $rgid.

I've also noticed form validation "illegal choice detected" errors when there's more than 20 conditions (i.e. more than the default $delta of 10) when deleting many conditions at one time. Unsure of the best way to get around that, but the rest is working well.

quicksketch’s picture

Status: Needs review » Fixed
FileSize
5.56 KB

I've also noticed form validation "illegal choice detected" errors when there's more than 20 conditions (i.e. more than the default $delta of 10) when deleting many conditions at one time.

That's probably caused by the number of elements influencing the available values in the weight field. If there were once 15 conditionals and one of the conditionals had a weight defined of "-12", the -12 option wouldn't exist any more if you removed 5 conditionals. So Drupal throws an error because the default value was set to something that doesn't exist.

I modified your patch slightly to keep track of the "max" number of conditionals that have been used and always uses that $delta for the weight field. Seems to pass all my testing but another look would be appreciated. In the mean time I've committed this to the 4.x branch. Thanks!

fenstrat’s picture

Yep, you're spot on with your reasoning for the "illegal choice detected" @quicksketch. Nice work around. Tested, works well.

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