On older version of Flag, flags had weights that could be rearranged in the main flag admin list. The weight of flags affected the order in which they were displayed in entity links.
On D8, flag config entities still have a weight property, but the flag list doesn't have anything to change the order.
An alternative to restoring this to the UI is that we could consider that the majority of users will probably want flags output as pseudofields (with absolutely no evidence of course, other than using pseudofields gives you much more control over output). If we accept that, then that leaves the entity links system as an optional extra. The weights system only affects the entity links output, and thus there would be a case that the weights system could possibly be removed and left for contrib to handle? (Note that allowing this would require us to deal with #2410467: use ThirdPartySettingsTrait... which I suppose we will need to deal with anyway.)
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | 2471174-21.flag_flag-draggable-ui.patch | 3.47 KB | drnikki |
| #20 | 2471172-20.flag_.flag-draggable-ui.patch | 3.47 KB | joachim |
| #11 | 2471172-11.patch | 1.8 KB | joshi.rohit100 |
| #6 | 2471172.flag_.flag-draggable-ui.patch | 1.85 KB | joachim |
Comments
Comment #1
joachim commentedWe need to use https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Config!Entity!Dra...
Comment #2
joachim commentedGot this working.
Depends on #2564529: Flag weight doesn't get saved.
Comment #3
joshi.rohit100Yes! DraggableListBuilder is what we need to set the weight through UI
Comment #4
joshi.rohit100Yes! DraggableListBuilder is what we need to set the weight through UI
Comment #5
joachim commentedYup, I'll post a patch tonight.
Comment #6
joachim commentedHere's the patch. This depends on #2564529: Flag weight doesn't get saved.
Comment #7
joshi.rohit100shouldn't we export weight ?
Comment #8
joachim commented> shouldn't we export weight ?
I think that's what's dealt with in #2564529: Flag weight doesn't get saved.
Comment #9
joshi.rohit100Oops! my bad ):
Comment #11
joshi.rohit100re-rolled
Comment #13
joshi.rohit100I think this needs test
Comment #14
joshi.rohit100On UI, draggable is there but its not working. Also, do we need to have schema for weigh key ?
Comment #15
joachim commentedWhat do you mean by 'not working'? If it's not saving, that's because you need #2564529: Flag weight doesn't get saved. Could you review that one please?
Comment #16
joachim commentedThe 2nd patch fixes a missing space here:
> + '#markup' => $entity->isEnabled() ? t('enabled') : t('disabled'),
but has incorrect indentation for the getFormId() docblock and misses a terminal array comma.
Comment #18
socketwench commentedLooks good so far, but it needs tests.
Comment #19
joachim commentedWe can probably do a frankencode from testTaxonomyAdminChangingWeights() ;)
Comment #20
joachim commentedHere's a new patch with a test.
I've also change the form key of the draggable element to 'flags' rather than the default of 'entities' (which is what taxonomy module does too).
Comment #21
drnikki commentedWorks great & saves in the UI, but still missing a space on ln 91.
'#markup' =>$entity->isEnabled() ? t('enabled') : t('disabled').
Attached fixes that space. :)
Comment #22
socketwench commentedThis is an awesome improvement!
Comment #23
joachim commentedBrilliant!
Thanks for the review & rerolls everyone :)
Comment #26
ivnish