Commit 43418728 authored by Dave Reid's avatar Dave Reid

by Dave Reid: Added xmlsitemap_link_bundle_rename().

parent 6b770dd0
......@@ -996,6 +996,15 @@ function xmlsitemap_link_bundle_settings_save($entity, $bundle, array $settings,
//xmlsitemap_get_link_info(NULL, TRUE);
}
function xmlsitemap_link_bundle_rename($entity, $bundle_old, $bundle_new) {
if ($bundle_old != $bundle_new) {
$settings = xmlsitemap_link_bundle_settings_load($entity, $bundle_old);
variable_del("xmlsitemap_settings_{$entity}_{$bundle_old}");
xmlsitemap_link_bundle_settings_save($entity, $bundle_new, $settings, FALSE);
xmlsitemap_update_links(array('subtype' => $bundle_new), array('type' => $entity, 'subtype' => $bundle_old));
}
}
function xmlsitemap_link_bundle_settings_load($entity, $bundle) {
$settings = variable_get("xmlsitemap_settings_{$entity}_{$bundle}", array());
$settings += array('status' => 0, 'priority' => 0.5);
......
......@@ -104,10 +104,7 @@ function xmlsitemap_node_node_type_update(stdClass $info) {
// Cannot perform xmlsitemap_link_bundle_settings_save() here since
// node_type_form_submit() strips all non-essential data from $info.
if (!empty($info->old_type) && $info->old_type != $info->type) {
$setting = variable_get('xmlsitemap_settings_node_'. $info->old_type, array());
variable_del('xmlsitemap_settings_node_'. $info->old_type);
variable_set('xmlsitemap_settings_node_'. $info->type, $setting);
xmlsitemap_update_links(array('subtype' => $info->type), array('type' => 'node', 'subtype' => $info->old_type));
xmlsitemap_link_bundle_rename('node', $info->old_type, $info->type);
}
}
......@@ -253,18 +250,3 @@ function xmlsitemap_node_create_link(&$node) {
return $node->xmlsitemap;
}
/**
* Internal default variables for xmlsitemap_node_var().
*/
function xmlsitemap_node_variables() {
$defaults = array();
$node_types = array_keys(node_type_get_names());
foreach ($node_types as $node_type) {
$defaults['xmlsitemap_settings_node_' . $node_type] = array(
'status' => 0,
'priority' => 0.5,
);
}
return $defaults;
}
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