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.
Hi,
in my project I need rules action for reset a flag
Comment | File | Size | Author |
---|---|---|---|
#1 | flag-reset-flag-2166975.patch | 1.38 KB | zestagio |
Comments
Comment #1
zestagio CreditAttribution: zestagio commentedComment #2
shabana.navas CreditAttribution: shabana.navas commentedThanks @zestagio. Looks good, but I am not sure how many people will really use this rules action. Would hate to bloat the module with lots of actions that only a random few will use.
I think if we have enough people who want this feature to go into the module, then, we can go ahead and think about adding it.
Comment #3
torgosPizzaThis is a feature I would like, because "trim a flag" does not have enough flexibility for us. Our use case:
- We have commerce products referenced by their display nodes.
- Sometimes there are more than one product attached to these display nodes, but not always.
- I just wrote #2659736: Add a "product is flagged" condition (patch inside) to allow flag-based Commerce Discounts
- To create a new discount that does not exclude previously flagged products, I can't set "trim" to 1 or 2 because this could lead to inconsistent results. The only real option os to reset the flag, and then apply the flag to the new products.
Therefore adding a "reset" action to the scheduled "Flag a product" action component will take the guesswork out of trimming previously flagged discount products.
Thanks!
EDIT: One thing I think could be an issue is that the Action appears to require an entity_id, whereas the reset function itself only has this as an optional parameter. (By default it removes all flags from those entities, but when an entity_id is specified, it removes that entity's flags.) Unless there's a way to specify NULL in the Rules UI's parameter field for that action this patch may Need Work.