function xmlsitemap_menu_create_link in XML sitemap 7.2
Same name and namespace in other branches
- 6.2 xmlsitemap_menu/xmlsitemap_menu.module \xmlsitemap_menu_create_link()
Create a sitemap link from a menu item.
Parameters
array $menu_item: A loaded menu item.
1 call to xmlsitemap_menu_create_link()
- xmlsitemap_menu_xmlsitemap_process_menu_links in xmlsitemap_menu/
xmlsitemap_menu.module - Process menu sitemap links.
File
- xmlsitemap_menu/
xmlsitemap_menu.module, line 251 - Main file for XML sitemap menu.
Code
function xmlsitemap_menu_create_link(array $menu_item) {
if (!isset($menu_item['xmlsitemap'])) {
$menu_item['xmlsitemap'] = array();
if ($menu_item['mlid'] && ($link = xmlsitemap_link_load('menu_link', $menu_item['mlid']))) {
$menu_item['xmlsitemap'] = $link;
}
}
$settings = xmlsitemap_link_bundle_load('menu_link', $menu_item['menu_name']);
$menu_item['xmlsitemap'] += array(
'type' => 'menu_link',
'id' => $menu_item['mlid'],
'status' => $settings['status'],
'status_default' => $settings['status'],
'status_override' => 0,
'priority' => $settings['priority'],
'priority_default' => $settings['priority'],
'priority_override' => 0,
);
// The following values must always be checked because they are volatile.
$menu_item['xmlsitemap']['loc'] = $menu_item['href'];
$menu_item['xmlsitemap']['subtype'] = $menu_item['menu_name'];
$menu_item['xmlsitemap']['access'] = $menu_item['access'] && !$menu_item['external'] && !$menu_item['hidden'];
$menu_item['xmlsitemap']['language'] = isset($menu_item['options']['langcode']) ? $menu_item['options']['langcode'] : LANGUAGE_NONE;
// Exclude menu items created for nodes that are added by xmlsitemap_node.
if ($menu_item['xmlsitemap']['access'] && $menu_item['router_path'] == 'node/%' && module_exists('xmlsitemap_node')) {
$node = node_load(substr($menu_item['link_path'], 5));
if ($node) {
if (empty($node->xmlsitemap)) {
xmlsitemap_node_create_link($node);
}
if ($node->xmlsitemap['status'] && $node->xmlsitemap['access']) {
$menu_item['xmlsitemap']['status'] = FALSE;
}
}
}
return $menu_item['xmlsitemap'];
}