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.)

Comments

joachim’s picture

joachim’s picture

Got this working.

Depends on #2564529: Flag weight doesn't get saved.

joshi.rohit100’s picture

Yes! DraggableListBuilder is what we need to set the weight through UI

joshi.rohit100’s picture

Yes! DraggableListBuilder is what we need to set the weight through UI

joachim’s picture

Assigned: Unassigned » joachim

Yup, I'll post a patch tonight.

joachim’s picture

Status: Active » Needs review
StatusFileSize
new1.85 KB

Here's the patch. This depends on #2564529: Flag weight doesn't get saved.

joshi.rohit100’s picture

shouldn't we export weight ?

joachim’s picture

> shouldn't we export weight ?

I think that's what's dealt with in #2564529: Flag weight doesn't get saved.

joshi.rohit100’s picture

Oops! my bad ):

Status: Needs review » Needs work

The last submitted patch, 6: 2471172.flag_.flag-draggable-ui.patch, failed testing.

joshi.rohit100’s picture

Status: Needs work » Needs review
StatusFileSize
new1.8 KB

re-rolled

Status: Needs review » Needs work

The last submitted patch, 11: 2471172-11.patch, failed testing.

joshi.rohit100’s picture

Issue tags: +Needs tests

I think this needs test

joshi.rohit100’s picture

On UI, draggable is there but its not working. Also, do we need to have schema for weigh key ?

joachim’s picture

What 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?

joachim’s picture

Status: Needs work » Needs review
Issue tags: +Needs reroll

The 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.

socketwench queued 11: 2471172-11.patch for re-testing.

socketwench’s picture

Status: Needs review » Needs work

Looks good so far, but it needs tests.

joachim’s picture

We can probably do a frankencode from testTaxonomyAdminChangingWeights() ;)

joachim’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests, -Needs reroll
StatusFileSize
new3.47 KB

Here'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).

drnikki’s picture

StatusFileSize
new3.47 KB

Works great & saves in the UI, but still missing a space on ln 91.
'#markup' =>$entity->isEnabled() ? t('enabled') : t('disabled').

Attached fixes that space. :)

socketwench’s picture

Status: Needs review » Reviewed & tested by the community

This is an awesome improvement!

joachim’s picture

Status: Reviewed & tested by the community » Fixed

Brilliant!
Thanks for the review & rerolls everyone :)

  • joachim committed 63bc162 on 8.x-4.x
    Issue #2471172 by joachim, joshi.rohit100, drnikki: Fixed flag weight...

Status: Fixed » Closed (fixed)

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

ivnish’s picture

Assigned: joachim » Unassigned