You are here

function xmlsitemap_sitemap_load_by_context in XML sitemap 7.2

Same name and namespace in other branches
  1. 6.2 xmlsitemap.module \xmlsitemap_sitemap_load_by_context()

Load an XML sitemap array from the database based on its context.

Parameters

array $context: An optional XML sitemap context array to use to find the correct XML sitemap. If not provided, the current site's context will be used.

See also

xmlsitemap_get_current_context()

Related topics

4 calls to xmlsitemap_sitemap_load_by_context()
XMLSitemapTestHelper::drupalGetSitemap in ./xmlsitemap.test
Retrieves an XML sitemap.
xmlsitemap_output_chunk in ./xmlsitemap.pages.inc
Output a sitemap page.
xmlsitemap_robotstxt in ./xmlsitemap.module
Implements hook_robotstxt().
xmlsitemap_sitemap_edit_form_validate in ./xmlsitemap.admin.inc
Edit form validate.

File

./xmlsitemap.module, line 425
xmlsitemap XML sitemap

Code

function xmlsitemap_sitemap_load_by_context(array $context = NULL) {
  if (!isset($context)) {
    $context = xmlsitemap_get_current_context();
  }
  $hash = xmlsitemap_sitemap_get_context_hash($context);
  $smid = db_query_range("SELECT smid FROM {xmlsitemap_sitemap} WHERE smid = :hash", 0, 1, array(
    ':hash' => $hash,
  ))
    ->fetchField();
  return xmlsitemap_sitemap_load($smid);
}