function views_custom_cache_plugin_cache::get_first_arg in Views custom cache 7
Custom function which takes the first argument of view.
2 calls to views_custom_cache_plugin_cache::get_first_arg()
- views_custom_cache_plugin_cache::get_output_key in views/
views_custom_cache_plugin_cache.inc - Implements views_plugin_cache#get_output_key().
- views_custom_cache_plugin_cache::get_results_key in views/
views_custom_cache_plugin_cache.inc - Implements views_plugin_cache#get_results_key().
File
- views/
views_custom_cache_plugin_cache.inc, line 222 - Views custom cache first argument plugin.
Class
- views_custom_cache_plugin_cache
- Views caching given view's first argument.
Code
function get_first_arg() {
global $language;
$key = '';
if (!empty($_GET['page'])) {
$key .= $_GET['page'];
}
elseif (!empty($_POST['page'])) {
$key .= $_POST['page'];
}
if (!empty($_GET['f'])) {
// search api facets.
$key .= serialize($_GET['f']);
}
if (!empty($this->view->args)) {
$values = array_values($this->view->args);
$key .= $values[0];
}
if (!empty($this->view->exposed_raw_input)) {
$values = array_values($this->view->exposed_raw_input);
$key .= $values[0];
}
if (empty($key)) {
$key = 'none';
}
else {
$key = md5($key);
}
$key .= ':' . $language->language;
return $key;
}