You are here

function pathauto_field_attach_rename_bundle in Pathauto 7

Same name and namespace in other branches
  1. 6.2 pathauto.module \pathauto_field_attach_rename_bundle()
  2. 6 pathauto.module \pathauto_field_attach_rename_bundle()

Implements hook_field_attach_rename_bundle().

Respond to machine name changes for pattern variables.

File

./pathauto.module, line 214
Main file for the Pathauto module, which automatically generates aliases for content.

Code

function pathauto_field_attach_rename_bundle($entity_type, $bundle_old, $bundle_new) {
  $variables = db_select('variable', 'v')
    ->fields('v', array(
    'name',
  ))
    ->condition('name', db_like("pathauto_{$entity_type}_{$bundle_old}_") . '%', 'LIKE')
    ->execute()
    ->fetchCol();
  foreach ($variables as $variable) {
    $value = variable_get($variable, '');
    variable_del($variable);
    $variable = strtr($variable, array(
      "{$entity_type}_{$bundle_old}" => "{$entity_type}_{$bundle_new}",
    ));
    variable_set($variable, $value);
  }
}