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.
When using the Trim Flag rule there is only one option that exists, to trim the oldest flag based on the flagged order. Since I'm using Flag Weight and Views so that users can organize their flagged nodes by custom order, I would like to be able to automatically trim the flag with the greatest flag weight. Also it would be nice to see an option to trim the newest flag in order to prevent new flags once a limit is reached.
Comment | File | Size | Author |
---|---|---|---|
#5 | flag-feature_trim_newest-1988258-5.patch | 2.86 KB | shabana.navas |
#2 | flag-feature_trim_newest-1988258-2.patch | 2.85 KB | shabana.navas |
Comments
Comment #1
joachim CreditAttribution: joachim commentedThe Rules integration is currently unmaintained, so this issue is entirely dependent on users of Rules providing a patch.
Comment #2
shabana.navas CreditAttribution: shabana.navas commented> Also it would be nice to see an option to trim the newest flag in order to prevent new flags once a limit is reached.
The attached patch takes care of this. As for trimming flags with the greatest weight, ASFAIK, the flag_weights module does not have a stable version that integrates with the newest version of the flag module. Consequently, I think that can wait until the maintainers for that module releases a stable version.
Comment #3
joachim CreditAttribution: joachim commentedThanks for working on this.
Here's a quick eyeball review:
If we're adding to an API function on our stable branch, we should make this param optional and default to the existing behaviour.
Remember to trim whitespace :) Your text editor should have a command to do this automatically.
Also, wrap comments to 80 chars and finish sentences with a .
How is the addition of a param going to affect existing rules? (Could users of Rules try this out please?)
Is there a way to declare this as optional?
Comment #4
shabana.navas CreditAttribution: shabana.navas commentedJoachim, will update with the edits.
>Is there a way to declare this as optional?
Actually, this is an optional field. It shows up as a checkbox and is unchecked by default. So, it won't affect the existing rules until the checkbox is checked. And once it is checked, it will just trim the newest flags.
So, basically, it behaves like an option field and defaults to the existing behavior of rules.
Comment #5
shabana.navas CreditAttribution: shabana.navas commentedThe updated patch is attached. Let me know if I have missed anything. Thanks.
Comment #6
shabana.navas CreditAttribution: shabana.navas commentedCommitted to 7.x-3.x branch.