You are here

function _xmlsitemap_sitemap_context_summary in XML sitemap 2.x

Same name and namespace in other branches
  1. 8 xmlsitemap.module \_xmlsitemap_sitemap_context_summary()
  2. 6.2 xmlsitemap.module \_xmlsitemap_sitemap_context_summary()
  3. 7.2 xmlsitemap.module \_xmlsitemap_sitemap_context_summary()

Gets summary about a context.

Parameters

\Drupal\xmlsitemap\XmlSitemapInterface $sitemap: Sitemap entity.

string $context_key: Key for the context.

array $context_info: Info about the context.

Return value

string Context summary.

Related topics

File

./xmlsitemap.module, line 1425
xmlsitemap XML sitemap

Code

function _xmlsitemap_sitemap_context_summary(XmlSitemapInterface $sitemap, $context_key, array $context_info) {
  $context_value = isset($sitemap->context[$context_key]) ? $sitemap->context[$context_key] : NULL;
  if (!isset($context_value)) {
    return t('Default');
  }
  elseif (!empty($context_info['summary callback'])) {
    return $context_info['summary callback']($context_value);
  }
  else {
    return $context_value;
  }
}