hook_query_alter(Drupal\Core\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()
AlterableInterface
SelectInterface
Related topics
- Database abstraction layer
- Allow the use of different database servers using the same code base.
- Hooks
- Define functions that alter the behavior of Drupal core.
File
- core/lib/Drupal/Core/Database/database.api.php, line 403
- Hooks related to the Database system and the Schema API.
Code
function hook_query_alter(Drupal\Core\Database\Query\AlterableInterface $query) { if ($query->hasTag('micro_limit')) { $query->range(0, 2); } }
Please login to continue.