Closed (fixed)
Project:
Rules Session Variables
Version:
7.x-1.0
Component:
Code
Priority:
Normal
Category:
Plan
Assigned:
Unassigned
Reporter:
Created:
8 Sep 2016 at 11:27 UTC
Updated:
5 Apr 2022 at 21:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
rjjakes commentedI've done a D8 port, I'll post in a second....
Comment #3
rjjakes commentedSee the attached patch for a D8 version. This creates two action plugins for setting and deleting a session variable and a conditions API plugin for checking if a session key/value is set.
I'm doing a lot with the Conditions API at the moment, so I'm happy to become a maintainer of the 8.x branch if you want?
Comment #4
rjjakes commentedComment #5
heddnInstead of using session, should we be using the user private temp store instead? https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21TempStore...
Is this planned for a follow-up issue? Or will that come into this patch before it lands?
Should this be inheritdoc? Where this is doEvaluate referenced from?
This seems to be an incorrect comment. Copy/paste?
Comment #6
vdsh commentedHere is an updated patch. In my opinion, we should keep session and not private temp store, as the private temp store is used to store heavy objects (here we just handle really small objects)
Regarding your other comments (thanks for the review btw):
#1: this was coming from a copy/paste in the rules module. I removed it
#2: yes it should be inheritdoc, as this is coming from RulesConditionBase
#3: it was indeed an incorrect comment (bad copy/paste I guess), I updated the comment
Additionnally, I have changed a little bit the event, you can now test whether a key exists or whether a session[key] has a specific value (2 different events)
I am also using the D8 way of accessing the session variable (and not $_SESSION)
Can you please review? It would be great if you can start a D8 version of this module anyway, and have this in dev or alpha. Happy to become maintainer to handle this, or you can name rjjakes as he volunteered 2 years ago - if you don't have time to do it.
Comment #7
heddnHere's a few changes. Mainly addition of tests.
Comment #8
vdsh commentedHi Heddn,
Good call using $this->requestStack->getCurrentRequest(); It's better than the \Drupal::request() I wrote
Looking at the fact that all classes have the same constructors / create, it may make more sense to have an abstract parent class. But then, I don't expect to get too many new features so may not be worth it.
I saw that you created a dev version but I believe the naming convention is incorrect:
2.0.x-dev -> 8.x-2.x-dev
Should you go and create a 8.x beta or even release? Users will probably download that more than if there is 'only' a dev version
Comment #9
heddnre #8: https://www.drupal.org/node/3108648 => we have real semantic versioning now.
We could add a Trait for the constructors, etc. But that has some issues on older versions of PHP. We couldn't easily have a base class, because the class inheritance between actions and conditions is entirely different. Or, rather, we could have 2 base classes that repeat each other. I went with just repeating ourselves. This module sees so little activity, and we aren't talking about all that much code... why not.
Comment #10
heddnLooks like I forgot to mark this fixed.
Comment #12
delacosta456 commentedhi
please is there any RC version with compatibility for D9 in plan?