1 path.module | path_field_attach_rename_bundle($entity_type, $bundle_old, $bundle_new) |
Implements hook_field_attach_rename_bundle().
Respond to machine name changes for pattern variables.
File
- core/
modules/ path/ path.module, line 552 - Enables users to customize URLs and provide automatic URL alias patterns.
Code
function path_field_attach_rename_bundle($entity_type, $bundle_old, $bundle_new) {
$config = config('path.settings');
$path_config_data = $config->get();
foreach ($path_config_data as $config_key => $config_value) {
if (strpos($config_key, "{$entity_type}_{$bundle_old}_") === 0) {
$config->clear($config_key);
$config_key = str_replace("{$entity_type}_{$bundle_old}", "{$entity_type}_{$bundle_new}", $config_key);
$config->set($config_key, $config_value);
}
}
$config->save();
}