You are here

function auto_entitylabel_field_attach_rename_bundle in Automatic Entity Label 7

Implements hook_field_attach_rename_bundle().

File

./auto_entitylabel.module, line 482
Allows hiding of entity label fields and automatic label creation.

Code

function auto_entitylabel_field_attach_rename_bundle($entity_type, $bundle_old, $bundle_new) {
  static $variables = array(
    'auto_entitylabel',
    'auto_entitylabel_pattern',
    'auto_entitylabel_php',
  );
  if ($bundle_old !== $bundle_new) {
    foreach ($variables as $variable) {
      $key_old = $variable . '_' . $entity_type . '_' . $bundle_old;
      $key_new = $variable . '_' . $entity_type . '_' . $bundle_new;
      variable_set($key_new, variable_get($key_old, ''));
      variable_del($key_old);
    }
  }
}