Skip navigation
Help

field_associate_fields

7 field.module field_associate_fields($module)

Allows a module to update the database for fields and columns it controls.

Parameters

string $module: The name of the module to update on.

Related topics

2 calls to field_associate_fields()

File

drupal/modules/field/field.module, line 423
Attach custom data fields to Drupal entities.

Code

function field_associate_fields($module) {
  // Associate field types.
  $field_types = (array) module_invoke($module, 'field_info');
  foreach ($field_types as $name => $field_info) {
    watchdog('field', 'Updating field type %type with module %module.', array('%type' => $name, '%module' => $module));
    db_update('field_config')
      ->fields(array('module' => $module, 'active' => 1))
      ->condition('type', $name)
      ->execute();
  }
  // Associate storage backends.
  $storage_types = (array) module_invoke($module, 'field_storage_info');
  foreach ($storage_types as $name => $storage_info) {
    watchdog('field', 'Updating field storage %type with module %module.', array('%type' => $name, '%module' => $module));
    db_update('field_config')
      ->fields(array('storage_module' => $module, 'storage_active' => 1))
      ->condition('storage_type', $name)
      ->execute();
  }
}