function _views_get_query in Views (for Drupal 7) 5
1 call to _views_get_query()
- views_build_view in ./
views.module - This builds the basic view.
File
- ./
views_cache.inc, line 274
Code
function _views_get_query(&$view, $args, $filters) {
if ($view->is_cacheable && ($cached = cache_get('views_query:' . $view->name, 'cache_views'))) {
$info = unserialize($cached->data);
$plugins = _views_get_style_plugins();
if ($plugins[$view->type]['needs_table_header']) {
$view->table_header = _views_construct_header($view, _views_get_fields());
}
}
else {
views_load_query();
$info = _views_build_query($view, $args, $filters);
if ($view->is_cacheable) {
cache_set('views_query:' . $view->name, 'cache_views', serialize($info));
}
}
// Run-time replacement so we can do cacheing
$replacements = module_invoke_all('views_query_substitutions', $view);
foreach ($replacements as $src => $dest) {
$info['query'] = str_replace($src, $dest, $info['query']);
$info['countquery'] = str_replace($src, $dest, $info['countquery']);
if (is_array($info['args'])) {
foreach ($info['args'] as $id => $arg) {
$info['args'][$id] = str_replace($src, $dest, $arg);
}
}
}
return $info;
}