function views_query_views_alter
Implements hook_query_TAG_alter().
This is the hook_query_alter() for queries tagged by Views and is used to add in substitutions from hook_views_query_substitutions().
2 calls to views_query_views_alter()
- views_handler_relationship_groupwise_max::left_query in handlers/
views_handler_relationship_groupwise_max.inc - 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 generate the subquery when the options are saved, rather than when the view is run. This saves considerable time.
- _views_query_tag_alter_condition in ./
views.module - Replaces the substitutions recursive foreach condition.
File
-
./
views.module, line 2396
Code
function views_query_views_alter(QueryAlterableInterface $query) {
$substitutions = $query->getMetaData('views_substitutions');
$tables =& $query->getTables();
$where =& $query->conditions();
// Replaces substitions in tables.
foreach ($tables as $table_name => $table_metadata) {
foreach ($table_metadata['arguments'] as $replacement_key => $value) {
if (isset($substitutions[$value])) {
$tables[$table_name]['arguments'][$replacement_key] = $substitutions[$value];
}
}
}
// Replaces substitions in filter criterias.
_views_query_tag_alter_condition($query, $where, $substitutions);
}