Issue #1566394 by dawehner | rszrama: Fixed views_handler_relationship_groupwise_max() does not export its subquery_string().
parent
b7f78ee2da
commit
b1102f7302
|
@ -151,21 +151,6 @@ class views_handler_relationship_groupwise_max extends views_handler_relationshi
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 @@ class views_handler_relationship_groupwise_max extends views_handler_relationshi
|
|||
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 @@ class views_handler_relationship_groupwise_max extends views_handler_relationshi
|
|||
}
|
||||
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'])) {
|
||||
|
|
Loading…
Reference in New Issue