function hook_query_xmlsitemap_generate_alter in XML sitemap 7.2
Same name and namespace in other branches
- 8 xmlsitemap.api.php \hook_query_xmlsitemap_generate_alter()
- 6.2 xmlsitemap.api.php \hook_query_xmlsitemap_generate_alter()
- 2.x xmlsitemap.api.php \hook_query_xmlsitemap_generate_alter()
Alter the query selecting data from {xmlsitemap} during sitemap generation.
Parameters
QueryAlterableInterface $query: A Query object describing the composite parts of a SQL query.
See also
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_TAG_alter().
File
- ./
xmlsitemap.api.php, line 281 - Hooks provided by the XML sitemap module.
Code
function hook_query_xmlsitemap_generate_alter(QueryAlterableInterface $query) {
$sitemap = $query
->getMetaData('sitemap');
if (!empty($sitemap->context['vocabulary'])) {
$node_condition = db_and();
$node_condition
->condition('type', 'taxonomy_term');
$node_condition
->condition('subtype', $sitemap->context['vocabulary']);
$normal_condition = db_and();
$normal_condition
->condition('type', 'taxonomy_term', '<>');
$condition = db_or();
$condition
->condition($node_condition);
$condition
->condition($normal_condition);
$query
->condition($condition);
}
}