1.20.x field.install field_update_1001()

Add missing entity type and bundle information to Field config files.

File

modules/field/field.install, line 82
Install, update and uninstall functions for the field module.

Code

function field_update_1001() {
  $names = config_get_names_with_prefix('field.bundle.');
  foreach ($names as $name) {
    $config = config($name);
    list(, , $entity_type, $bundle) = explode('.', $name);
    $settings = $config->get();
    $data = array(
      'entity_type' => $entity_type,
      'bundle' => $bundle,
    ) + $settings;
    $config->setData($data);
    $config->save();
  }
}