You are here

function xmlsitemap_query_xmlsitemap_link_bundle_access_alter in XML sitemap 7.2

Implements hook_query_TAG_alter().

File

./xmlsitemap.xmlsitemap.inc, line 385
XML sitemap integration functions for xmlsitemap.module.

Code

function xmlsitemap_query_xmlsitemap_link_bundle_access_alter(QueryAlterableInterface $query) {
  if ($query instanceof EntityFieldQuery && ($entity = $query
    ->getMetaData('entity'))) {
    $info = $query
      ->getMetaData('entity_info');
    $bundle = $query
      ->getMetaData('bundle');
    if (empty($bundle)) {
      $bundle = xmlsitemap_get_link_type_enabled_bundles($entity);
    }
    $query
      ->entityCondition('bundle', $bundle, is_array($bundle) ? 'IN' : '=');
  }
}