function xmlsitemap_sitemap_load_by_context

7.x xmlsitemap.module xmlsitemap_sitemap_load_by_context(array $context = NULL)
6.x xmlsitemap.module xmlsitemap_sitemap_load_by_context(array $context = NULL)

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

Parameters

$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/xmlsitemap.test
Retrieves an XML sitemap.
xmlsitemap_output_chunk in xmlsitemap/xmlsitemap.pages.inc
Output a sitemap page.
xmlsitemap_robotstxt in xmlsitemap/xmlsitemap.module
Implements hook_robotstxt().
xmlsitemap_sitemap_edit_form_validate in xmlsitemap/xmlsitemap.admin.inc

File

xmlsitemap/xmlsitemap.module, line 383
Main file for the xmlsitemap module.

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);
}