Skip to content
Snippets Groups Projects
Commit 01a33182 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #299176 by chx, Crell: added example of hook_query_alter to API documentation.

parent ff9b6c61
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -1451,14 +1451,17 @@ function hook_schema_alter(&$schema) { ...@@ -1451,14 +1451,17 @@ function hook_schema_alter(&$schema) {
* *
* @see hook_query_TAG_alter() * @see hook_query_TAG_alter()
* @see node_query_node_access_alter() * @see node_query_node_access_alter()
* * @see QueryAlterableInterface
* @see SelectQueryInterface
* @param $query * @param $query
* A Query object describing the composite parts of a SQL query. * A Query object describing the composite parts of a SQL query.
* @return * @return
* None. * None.
*/ */
function hook_query_alter(QueryAlterableInterface $query) { function hook_query_alter(QueryAlterableInterface $query) {
if ($query->hasTag('micro_limit')) {
$query->range(0, 2);
}
} }
/** /**
...@@ -1466,6 +1469,8 @@ function hook_query_alter(QueryAlterableInterface $query) { ...@@ -1466,6 +1469,8 @@ function hook_query_alter(QueryAlterableInterface $query) {
* *
* @see hook_query_alter() * @see hook_query_alter()
* @see node_query_node_access_alter() * @see node_query_node_access_alter()
* @see QueryAlterableInterface
* @see SelectQueryInterface
* *
* @param $query * @param $query
* An Query object describing the composite parts of a SQL query. * An Query object describing the composite parts of a SQL query.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment