How would I get a session value from a session variable stored in the Drupal way.
$tempstore = \Drupal::service('user.private_tempstore')->get('mymodule_name');
$tempstore->set('my_variable_name', $some_data);It is equivalent to:
$_SESSION['mymodule_name']['my_variable_name'] = $somedata;
So there seems to be an extra layer of 'mymodule_name'. Is that even possible to use with this module, or should we just use _SESSION directly when setting values?
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | deeper_array-2911802-2.patch | 2.65 KB | guptahemant |
Comments
Comment #2
guptahemant commentedHere is a patch attached to extend the functionality of this module to manage deeper level of sessions.
To specify multidimensional variables user has to specify Keys of SESSION variable seperated by ::, e.g. for $_SESSION["key1"]["key2"], the key would be "key1::key2".
Please review.
Comment #3
purushotam.rai commentedLGTM :)
Comment #5
purushotam.rai commented