Does not work with an ignored filter

Created on 4 July 2023, over 1 year ago

Problem/Motivation

I am using this module that does it job perfectly to isolate views caching between groups.
However, it dos not handle a specific filter that I use to configure the custom rendering og the views result.
Basically, I added a hidden field to the concerned node type (a checkbox list of parameters to set)
This field is not filled in any any node and does not show up anywhere.
I configured an exposed filter for this field and use its value in the render code.

The problem is that the settings of this field can only done at the time the cache is cleared. Afterwards, it keeps the value until the next cache flush.
This works correctly using the module Views content cache that is supposed to handle groups, but its is ineffective for this purpose.

Steps to reproduce

Add a dummy field to a node type subject to the views
Do not fill any value for this field
Create a view to display nodes of this type
Add a filter for the dummy field that you by pass by a permanent conditions (nid>1 for exemple)
Configure Views og cache for this views.
Verify that this filter can no longer be changed once the view is cached

Proposed resolution

I added $this->view->exposed_input, in both get_results_key and get_output_key

      $key_data = array(
        'build_info' => $build_info,
        'language' => $GLOBALS['language']->language,
        'base_url' => $GLOBALS['base_url'],
        'og_roles' => og_get_user_roles($og_context['group_type'], $og_context['gid']),
        'admin' => user_access('administer group'),
        'display_handler' => array(
          $this->view->display_handler->get_option('style_options'),
          $this->view->display_handler->get_option('pager'),
          $this->view->display_handler->get_option('arguments'),
	+ // Handle exposed filters
	+ $this->view->exposed_input,
        ),

Remaining tasks

Is this OK ?
Why did I had to do that?

User interface changes

API changes

Data model changes

💬 Support request
Status

Active

Version

1.0

Component

Code

Created by

🇫🇷France jvieille

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

Comments & Activities

Production build 0.71.5 2024