function xmlsitemap_get_link_info in XML sitemap 6.2
Same name and namespace in other branches
- 8 xmlsitemap.module \xmlsitemap_get_link_info()
- 7.2 xmlsitemap.module \xmlsitemap_get_link_info()
- 2.x xmlsitemap.module \xmlsitemap_get_link_info()
Returns information about supported sitemap link types.
Parameters
$type: (optional) The link type to return information for. If omitted, information for all link types is returned.
$reset: (optional) Boolean whether to reset the static cache and do nothing. Only used for tests.
See also
hook_xmlsitemap_link_info_alter()
13 calls to xmlsitemap_get_link_info()
- xmlsitemap_add_form_link_options in ./
xmlsitemap.admin.inc - Add a link's XML sitemap options to the link's form.
- xmlsitemap_add_link_bundle_settings in ./
xmlsitemap.admin.inc - Add the link type XML sitemap options to the link type's form.
- xmlsitemap_entity_extract_ids in ./
xmlsitemap.module - Backport of entity_extract_ids() from Drupal 7.
- xmlsitemap_entity_uri in ./
xmlsitemap.module - Backport of entity_uri() from Drupal 7.
- xmlsitemap_get_bundle_path in ./
xmlsitemap.module
File
- ./
xmlsitemap.module, line 890 - Main file for the xmlsitemap module.
Code
function xmlsitemap_get_link_info($type = NULL, $reset = FALSE) {
global $language;
$link_info =& xmlsitemap_static(__FUNCTION__);
if ($reset) {
$link_info = NULL;
cache_clear_all('xmlsitemap:link_info:', 'cache', TRUE);
}
if (!isset($link_info)) {
$cid = 'xmlsitemap:link_info:' . $language->language;
if ($cache = cache_get($cid)) {
$link_info = $cache->data;
}
else {
xmlsitemap_load_all_includes();
$link_info = module_invoke_all('xmlsitemap_link_info');
foreach ($link_info as $key => &$info) {
$info += array(
'type' => $key,
'base table' => FALSE,
'bundles' => array(),
'xmlsitemap' => array(),
'entity keys' => array(),
);
$info['entity keys'] += array(
'bundle' => '',
);
if (!isset($info['xmlsitemap']['rebuild callback']) && !empty($info['base table']) && !empty($info['entity keys']['id']) && !empty($info['xmlsitemap']['process callback'])) {
$info['xmlsitemap']['rebuild callback'] = 'xmlsitemap_rebuild_batch_fetch';
}
foreach ($info['bundles'] as $bundle => &$bundle_info) {
$bundle_info += array(
'xmlsitemap' => array(),
);
$bundle_info['xmlsitemap'] += xmlsitemap_link_bundle_load($key, $bundle, FALSE);
}
}
drupal_alter('xmlsitemap_link_info', $link_info);
ksort($link_info);
// Cache by language since this info contains translated strings.
cache_set($cid, $link_info);
}
}
if (isset($type)) {
return isset($link_info[$type]) ? $link_info[$type] : NULL;
}
return $link_info;
}