function hook_query_xmlsitemap_generate_alter in XML sitemap 8
Same name and namespace in other branches
- 6.2 xmlsitemap.api.php \hook_query_xmlsitemap_generate_alter()
- 7.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.
- language_query_xmlsitemap_generate_alter in ./
xmlsitemap.module - Implements hook_query_TAG_alter() for language module.
File
- ./
xmlsitemap.api.php, line 250 - 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 = $query
->andConditionGroup();
$node_condition
->condition('type', 'taxonomy_term');
$node_condition
->condition('subtype', $sitemap->context['vocabulary']);
$normal_condition = $query
->andConditionGroup();
$normal_condition
->condition('type', 'taxonomy_term', '<>');
$condition = $query
->orConditionGroup();
$condition
->condition($node_condition);
$condition
->condition($normal_condition);
$query
->condition($condition);
}
}