| 7 system.api.php | hook_query_alter(QueryAlterableInterface $query) |
| 8 system.api.php | hook_query_alter(Drupal Database Query AlterableInterface $query) |
Perform alterations to a structured query.
Structured (aka dynamic) queries that have tags associated may be altered by any module before the query is executed.
Parameters
$query: A Query object describing the composite parts of a SQL query.
See also
node_query_node_access_alter()
Related topics
3 functions implement hook_query_alter()
File
- core/
modules/ system/ system.api.php, line 2820 - Hooks provided by Drupal core and the System module.
Code
function hook_query_alter(Drupal Database Query AlterableInterface $query) {
if ($query->hasTag('micro_limit')) {
$query->range(0, 2);
}
}
Login or register to post comments