Skip to content
Snippets Groups Projects
Commit b1102f73 authored by Daniel Wehner's avatar Daniel Wehner Committed by Tim Plunkett
Browse files

Issue #1566394 by dawehner | rszrama: Fixed...

Issue #1566394 by dawehner | rszrama: Fixed views_handler_relationship_groupwise_max() does not export its subquery_string().
parent b7f78ee2
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -151,21 +151,6 @@ function options_form(&$form, &$form_state) {
);
}
/**
* Perform any necessary changes to the form values prior to storage.
* There is no need for this function to actually store the data.
*
* Generate the subquery string when the user submits the options, and store
* it. This saves the expense of generating it when the view is run.
*/
function options_submit(&$form, &$form_state) {
// Get the new user options from the form values.
$new_options = $form_state['values']['options'];
$subquery = $this->left_query($new_options);
// Add the subquery string to the options we're about to store.
$this->options['subquery_string'] = $subquery;
}
/**
* Helper function to create a pseudo view.
*
......@@ -179,6 +164,14 @@ function get_temporary_view() {
return $view;
}
/**
* When the form is submitted, take sure to clear the subquery string cache.
*/
function options_form_submit(&$form, &$form_state) {
$cid = 'views_relationship_groupwise_max:' . $this->view->name . ':' . $this->view->current_display . ':' . $this->options['id'];
cache_clear_all($cid, 'cache_views_data');
}
/**
* Generate a subquery given the user options, as set in the options.
* These are passed in rather than picked up from the object because we
......@@ -362,7 +355,15 @@ function query() {
}
else {
// Get the stored subquery SQL string.
$def['left_query'] = $this->options['subquery_string'];
$cid = 'views_relationship_groupwise_max:' . $this->view->name . ':' . $this->view->current_display . ':' . $this->options['id'];
$cache = cache_get($cid, 'cache_views_data');
if (isset($cache->data)) {
$def['left_query'] = $cache->data;
}
else {
$def['left_query'] = $this->left_query($this->options);
cache_set($cid, $def['left_query'], 'cache_views_data');
}
}
if (!empty($def['join_handler']) && class_exists($def['join_handler'])) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment