Let's say I want to use
$_SESSION['user_variable'] with a view as a filter value. I read that in Drupal 7 I could add such a value with custom PHP code. How should I do in Drupal 8? I didn't find an easy solution so far.
Would it be better to temporarily save a user's choice that is valid for the whole session in the database and tell the view to get the value from there?