function hook_entity_query_alter

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 system.api.php hook_entity_query_alter($query)
cle7 system.api.php hook_entity_query_alter($query)
elmsmedia7 system.api.php hook_entity_query_alter($query)
icor7 system.api.php hook_entity_query_alter($query)
meedjum_blog7 system.api.php hook_entity_query_alter($query)
mooc7 system.api.php hook_entity_query_alter($query)

Alter or execute an EntityFieldQuery.

Parameters

EntityFieldQuery $query: An EntityFieldQuery. One of the most important properties to be changed is EntityFieldQuery::executeCallback. If this is set to an existing function, this function will get the query as its single argument and its result will be the returned as the result of EntityFieldQuery::execute(). This can be used to change the behavior of EntityFieldQuery entirely. For example, the default implementation can only deal with one field storage engine, but it is possible to write a module that can query across field storage engines. Also, the default implementation presumes entities are stored in SQL, but the execute callback could instead query any other entity storage, local or remote.

Note the $query->altered attribute which is TRUE in case the query has already been altered once. This happens with cloned queries. If there is a pager, then such a cloned query will be executed to count all elements. This query can be detected by checking for ($query->pager && $query->count), allowing the driver to return 0 from the count query and disable the pager.

Related topics

3 functions implement hook_entity_query_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

field_test_entity_query_alter in modules/field/tests/field_test.module
Implements hook_entity_query_alter().
og_entity_query_alter in sites/all/modules/ulmus/og/og.module
Implements hook_entity_query_alter().
taxonomy_entity_query_alter in modules/taxonomy/taxonomy.module
Implements hook_entity_query_alter().

File

modules/system/system.api.php, line 403
Hooks provided by Drupal core and the System module.

Code

function hook_entity_query_alter($query) {
  $query->executeCallback = 'my_module_query_callback';
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.