Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The default #delta
for the weight form element is 10, which gives produces a range of -10...10 with which to order. Even with a modest number of states, the number of possible transitions can quickly exceed 20, leaving you with a range of transitions that become stuck with the same weight and cannot be reordered (at least via the UI).
Comment | File | Size | Author |
---|---|---|---|
#10 | Screen Shot 2018-04-22 at 8.42.24 AM.png | 37.68 KB | runeasgar |
#10 | Screen Shot 2018-04-22 at 8.41.17 AM.png | 45.16 KB | runeasgar |
#9 | interdiff-2939634-6-9.txt | 2.42 KB | kevin.dutra |
#9 | workflow-transition-ordering-2939634-9.patch | 2.74 KB | kevin.dutra |
#6 | workflow-transition-ordering-2939634-6.patch | 1.44 KB | kevin.dutra |
Comments
Comment #2
kevin.dutra CreditAttribution: kevin.dutra at Workday, Inc. commentedHere's a test to help demonstrate the issue.
Comment #3
kevin.dutra CreditAttribution: kevin.dutra at Workday, Inc. commentedAnd now after augmenting the #delta.
Comment #4
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedNice catch, bumping the available transition weights from 20 to 200 makes a lot of sense. A couple of things:
'#type' => 'weight'
.Maybe something as simple as:
Comment #5
kevin.dutra CreditAttribution: kevin.dutra at Workday, Inc. commentedMy one reservation with allowing there to be more states is that it causes the number of possible transitions to explode farther, which is why I left that one as-is. Hopefully people aren't trying to create tons of states because it makes for a much more complicated process for the end users who are using it, but I suppose there might be the odd exception that actually requires something that complex. For now I think I'll leave that one alone.
I'm totally on board for the test refactoring. :)
Comment #6
kevin.dutra CreditAttribution: kevin.dutra at Workday, Inc. commentedComment #7
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedLooks great, thanks.
Comment #8
alexpottWhy not count the number of transitions and use that? Any limit seems a bit arbitrary.
In blocks we do:
Comment #9
kevin.dutra CreditAttribution: kevin.dutra at Workday, Inc. commentedFair enough. Now it's dynamic based on the current number of transitions. I've gone ahead and added in a similar adjustment for states, as long as we're there.
Comment #10
runeasgar CreditAttribution: runeasgar as a volunteer commentedTesting.
curl -l https://www.drupal.org/files/issues/2018-04-13/workflow-transition-ordering-2939634-9.patch | git apply -v
drush cr
Moving to RTBC.
Comment #11
alexpottCommitted and pushed 6a74240ce3 to 8.6.x and ffaf769407 to 8.5.x. Thanks!
Backported to 8.5.x as a bugfix.