Comments

socketwench’s picture

This issue is postponed until event support is added to Rules. See https://www.drupal.org/node/2145343

shabana.navas’s picture

Am looking to get on it once the above issue is cleared up in Rules.

dasjo’s picture

Issue tags: +d8rules

While events aren't there yet, you can already implement actions & conditions for Rules. You can take a look at the core integrations that have been ported already:
https://github.com/fago/rules
#2269561: [META] Port all conditions to 8.x
#2269577: [META] Port all actions to 8.x

I think it would be great to create sub-tickets for creating some first action & condition integrations for the flag module to have a proof of concept for a first contrib module integrating with Rules 8.x :)

czigor’s picture

Issue summary: View changes
czigor’s picture

Issue summary: View changes
czigor’s picture

Issue summary: View changes
dasjo’s picture

Issue summary: View changes
dasjo’s picture

Status: Postponed » Active

Setting to active as some actions are already being ported. See their sub-tickets

martin107’s picture

triggering summary update

dasjo’s picture

note that rules events are now ready for porting as well #2513476: [META] Port all events to 8.x

dasjo’s picture

Issue summary: View changes
socketwench’s picture

We should start breaking down this meta into solvable issues now.

dasjo’s picture

I have pushed a few fixes to my flag fork: for example the Action namespace has been renamed to RulesAction within rules:
https://github.com/dasjo/flag/commits/8.x-4.x-rules

dasjo’s picture

Issue summary: View changes
Anonymous’s picture

Issue summary: View changes
Anonymous’s picture

Issue summary: View changes
Anonymous’s picture

Issue summary: View changes
Anonymous’s picture

Issue summary: View changes
emclaughlin’s picture

Question: do all of the Action ones now depend on #2470661: Port "Flag a [entity type]" Rules action to 8.x being approved and merged? It creates a FlagActionBase class that I assume all of the actions would need to use. I'd really like to dive into this.

joachim’s picture

That sounds quite likely. The patch on that issue needs review from someone who's familiar with Rules.

dasjo’s picture

#19 is correct, you would want to use the FlagActionBase from there

tr’s picture

Patch which implements "Flag is flagged" AND "Flag is unflagged" events, with tests, may be found in #2540032-21: Port "Flag is flagged" Rules event to Drupal 10+

If you're interested in getting Rules functionality into Flag, please review that patch!

I will work on the Conditions after these two Events are committed.

tr’s picture

As I stated 1.5 years ago, I am willing to do the work to port the Rules functionality for this module from D7 to D8. This is all predicated on getting the events ported first. Please review #2540032-21: Port "Flag is flagged" Rules event to Drupal 10+ if this is of interest to you.

CraigBertrand’s picture

Hey folks, what is the status on this? I have installed rules and flag and am having issues getting things to work.

I would be happy to test and perhaps do a how-to video from a user perspective as commits are made.

mobius_time’s picture

Hi all, what is the status of this? What does the road forward look like?

I am developing a site which I may have to do in D7 if Flags and Rules don't work nicely together.

I need to create a rule so that when particular flag is set on a comment or a node, I can then take action.

Thanks to the maintainers for all their hard work on this D8 port.

ivnish’s picture

Status: Active » Closed (outdated)
Issue tags: -d8rules

5 years without any activity. I think we can close it as outdated. Please reopen if needed.

tr’s picture

Status: Closed (outdated) » Active

@ivnish: This has been blocked for years by the previous Flag maintainer, NOT by lack of interest or work by contributors like me and others. Flag was not being maintained, no tests were being run, porting to D9/D10/D11 was not taking place, no patches were being accepted etc.

The initial patches in this issue to get Events put back into Flag were completed long ago. The other issues depend on that being done first. None of the issues were acted on by the maintainer. To make it clear, the Events patch was blocked because the maintainer wanted "someone more familiar with Rules than myself to mark it RTBC". And to make it more clear, I am the Rules maintainer - I would guess that right now there is no one in the world more familiar with Rules than me. If that wasn't good enough for the previous maintainer, then I don't know what is.

For years I and others have repeatedly done work and offered patches, and re-rolled patches, and answered questions, etc. and it became obvious that it was a waste of time to continue doing that UNLESS the maintainer was willing to review and commit all the contributed work. If that situation has changed, then it would be worthwhile to open MRs for all these issues and re-roll the patches and update everything to run in the current version of Drupal.

So please don't just close this, and please don't blame that on contributors not doing anything. We already spent years working on this and trying to keep it up-to-date. If, as the new Flag maintainer, you're willing to accept the work, then I will do the work.

Event integration is not just for Rules - it's for ANYONE who wants to use an event-based programming model. The proposed Events are not Rules-specific, and don't require Rules to be installed. But without them Rules can only interact with Flag through entity CRUD events, which are provided through core Drupal.

If you are willing to put Rules integration back into Flag, just say so and I will do the work, again, starting with the Events, then moving on to the Conditions and the Actions. All with test cases, of course. This Rules integration adds zero overhead - Event objects aren't even created if there are no Event listeners registered, and Plugins (Conditions and Actions) are never loaded unless they're explicitly requested. No sub-modules are needed. And while some of this integration can be provided outside of the Flag module (any contrib module can provide a plugin), without the Flag events none of that can be used effectively. So the Flag events are critical for Rules integration and testing, that's why this whole meta hinges on getting the events in place first.

ivnish’s picture

I don't see the point in integrating Rules integration into the flag now because:

1) A lot of years Rules was unusable for production (but I see TR in maintainers now :) )
2) There is Rules Flag
3) There is more modern ECA

But... If you will create good MR with tests I see no reason not to accept them

tr’s picture

I don't see the point in integrating Rules integration into the flag now because:

1) A lot of years Rules was unusable for production (but I see TR in maintainers now :) )
2) There is Rules Flag
3) There is more modern ECA

1) Not true. Rules has always been working and usable for production. If you mean there has only been alpha and beta releases for most of that time, that's true, but Flag is still beta after all these years too you know ... In the case of Rules, that meant that the D7 features hadn't been ported to D8/D9 yet. In the case of Flag, the features it had in D7 (which includes Rules support) *still* haven't been ported.

These days, in Drupal, nobody uses alpha or beta anymore - everybody makes a "stable" fixed-point release. But it's all semantics. Don't let yourself be fooled by names - a rose by any other name would smell as sweet. That's as true today as it was 450 years ago. I console myself with the knowledge that at least Rules was honest in advertising, but these days no one wants honesty ... if it's fixed-point they'll use it, if it's alpha or beta or -dev they won't. So most modules lie.

2) Nothing inherently wrong with Rules Flag, but it isn't being maintained and there is only so much that a contributed module can do as far as the integration goes. Otherwise all of this could be put into Rules proper. To get deep integration with Flag, you have to add the plugins to Flag. Now that Plugins are part of core, the whole idea of having to install and enable another module for integration is really pretty antiquated - that used to be done only for dependency purposes, but now we can do all that with Plugins with no overhead cost.

3) "more modern" ? The whole idea of 4GL (so-called "fourth-generation programming languages) which provide a complicated UI to avoid actually writing code dates back to the 80's. It was a big topic in the 90's, and with a few notable exceptions has mostly disappeared from mainstream programming. While I have nothing against this approach (I worked with and contributed to many of those 30 years ago), I personally have learned (through experience) that 4GL approaches result in compartmentalization and specialties - a large site relying on one of these will need an "expert" trained in that specific UI, which is different to and distinct from any other expertise in Drupal. This becomes a classic case of "job security" over time, since you usually only have one or a few people who know all the ins and outs for the UI, and those experts are needed in order to maintain and update the website. That's why the vast majority of programming is 3GL, with the "modern" and still unproven stuff being 5GL - the entire 4GL is being skipped over now because it never lived up to its promises. I have no desire to go down that rabbit hole again.

Regardless, this is not a referendum on Rules vs ECA. Flag has always has Rules integration and for at least 10 years I have been volunteering to port that from the D7 version to the current versions. Rules has more users than Flag in D10/D11, so I don't see any reason to turn down this offer.

But... If you will create good MR with tests I see no reason not to accept them

OK, I will hold you to that. It will take me a couple of weeks to open the MRs because I will be on travel until mid-March.

ivnish’s picture

Version: 8.x-4.x-dev » 5.x-dev
Category: Task » Feature request