Hi,

I'm facing a problem with the contextual filters on a view (block).
I would like to filter with a term stored in user.private_tempstore, or maybe a simple session variable if it is more convenient.

To explain a little more the situation, the user first fills a form in which a field "year" is selected and stored in user.private_tempstore on submit that also redirects to the page containing the view block.
In this page, I would like to display only documents of the selected year. A field "year" is set in the Documents content type (taxonomy term).

I found that in Drupal 7, there was a 'PHP Code' type in 'when the filter value is not in the URL'.
But I cannot find anything like this in Drupal 8.
Is there a way to achieve this ?

PS : I already tried to pass the year through URL, it works but it's not the way I want to do it. But if you have other approaches than the one I'm looking for, I'm opened of course. I'm a Drupal Newbie :).

Thanks a lot.

Comments

sachinsuryavanshi’s picture

Hello,

please check this URL --> https://www.drupal.org/project/views_extras

Might help!