You are here

function hook_query_xmlsitemap_generate_alter in XML sitemap 6.2

Same name and namespace in other branches
  1. 8 xmlsitemap.api.php \hook_query_xmlsitemap_generate_alter()
  2. 7.2 xmlsitemap.api.php \hook_query_xmlsitemap_generate_alter()
  3. 2.x xmlsitemap.api.php \hook_query_xmlsitemap_generate_alter()

Alter the query selecting data from {xmlsitemap} during sitemap generation.

Do not alter LIMIT or OFFSET as the query will be passed through db_query_range() with a set limit and offset.

Parameters

$query: An array of a query object, keyed by SQL keyword (SELECT, FROM, WHERE, etc).

$args: An array of arguments to be passed to db_query() with $query.

$sitemap: The XML sitemap object.

1 function implements hook_query_xmlsitemap_generate_alter()

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

xmlsitemap_i18n_query_xmlsitemap_generate_alter in xmlsitemap_i18n/xmlsitemap_i18n.module
Implements hook_query_xmlsitemap_generate_alter().
2 invocations of hook_query_xmlsitemap_generate_alter()
xmlsitemap_generate_chunk in ./xmlsitemap.generate.inc
xmlsitemap_generate_chunk in ./xmlsitemap.generate.inc

File

./xmlsitemap.api.php, line 188
Hooks provided by the XML sitemap module.

Code

function hook_query_xmlsitemap_generate_alter(array &$query, array &$args, stdClass $sitemap) {
  if (!empty($sitemap->context['vocabulary'])) {
    $query['WHERE'] .= " AND ((x.type = 'taxonomy_term' AND x.subtype = '%s') OR (x.type <> 'taxonomy_term')";
    $args[] = $sitemap->context['vocabulary'];
  }
}