[Meta] Implement Rules 8.x Support

Created on 11 February 2015, about 10 years ago
Updated 19 February 2025, about 2 months ago

Problem/Motivation

Flag 8.x presently does not include Rules support as Rules 8.x was not yet mature enough to begin development. Flag and Rules can do beautiful things together, and is a must for a complete version of the module.

Proposed resolution

Implement Rules support for flagging events, as well as conditions and actions.

Events

πŸ“Œ Port "Flag is flagged" Rules event to 8.x Needs work
πŸ“Œ Port "Flag is unflagged" Rules event to 8.x Closed: outdated

Conditions

πŸ“Œ Port "Flag threshold" Rules condition to 8.x Closed: outdated
πŸ“Œ Port "Flag is flagged" Rules condition to 8.x Closed: outdated

Actions

✨ Port "Fetch overall flag count" Rules action to 8.x Closed: outdated
✨ Port "Fetch user flag count" Rules action to 8.x Closed: outdated
✨ Port "Fetch [entity type] flagged by user" Rules action to 8.x Closed: outdated
✨ Port "Flag a [entity type]" Rules action to 8.x Closed: outdated
✨ Port "Unflag a [entity type]" Rules action to 8.x Closed: outdated
✨ Port "Fetch users who have flagged a [entity type]" Rules action to 8.x Closed: outdated
✨ Port "Fetch entity flag count" Rules action to 8.x Closed: outdated
✨ Port "Trim flag" Rules action to 8.x Closed: outdated

Remaining tasks

Code the plugins.

User interface changes

None.

API changes

None.

πŸ“Œ Task
Status

Closed: outdated

Version

4.0

Component

Rules integration

Created by

πŸ‡ΊπŸ‡ΈUnited States socketwench

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ivnish Kazakhstan

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

  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    @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 Kazakhstan

    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 ok, I will not close this issue

  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    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.

Production build 0.71.5 2024