Commit 9f881b3d authored by Dave Reid's avatar Dave Reid
Browse files

#1008566 by Dave Reid: Fixed bugs when altering XML sitemap settings for menus and menu links.

parent 30f8943a
......@@ -84,7 +84,7 @@ function xmlsitemap_menu_xmlsitemap_process_menu_links(array $mlids, array $xmls
* @see xmlsitemap_add_link_bundle_settings()
*/
function xmlsitemap_menu_form_menu_edit_menu_alter(&$form, $form_state) {
$menu = isset($form['menu_name']['#value']) ? $form['menu_name']['#value'] : '';
$menu = isset($form['menu_name']['#default_value']) ? $form['menu_name']['#default_value'] : '';
module_load_include('inc', 'xmlsitemap', 'xmlsitemap.admin');
xmlsitemap_add_link_bundle_settings($form, $form_state, 'menu', $menu);
}
......@@ -153,10 +153,28 @@ function xmlsitemap_menu_menu_link_insert(array $link) {
/**
* Implements hook_menu_link_update().
*
* @see hook_menu_link_alter()
*/
function xmlsitemap_menu_menu_link_update(array $link) {
$link += array('xmlsitemap' => array());
xmlsitemap_menu_xmlsitemap_process_menu_links(array($link['mlid']), $link['xmlsitemap']);
//$link += array('xmlsitemap' => array());
//xmlsitemap_menu_xmlsitemap_process_menu_links(array($link['mlid']), $link['xmlsitemap']);
}
/**
* Implements hook_menu_link_alter().
*
* We have to use this hook rather than hook_menu_link_update() because this
* hook is not always called if the user does not edit the core menu item
* fields.
*
* @see http://drupal.org/node/1013856
*/
function xmlsitemap_menu_menu_link_alter(array &$link) {
if (!empty($link['mlid'])) {
$link += array('xmlsitemap' => array());
xmlsitemap_menu_xmlsitemap_process_menu_links(array($link['mlid']), $link['xmlsitemap']);
}
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment