1 field.module field_associate_fields($module)

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

Parameters

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

Related topics

File

core/modules/field/field.module, line 626
Attach custom data fields to Backdrop entities.

Code

function field_associate_fields($module) {
  // Associate field types.
  $field_types = (array) module_invoke($module, 'field_info');
  $storage_types = (array) module_invoke($module, 'field_storage_info');
  $fields = field_read_fields();
  foreach ($fields as $field) {
    $old_field = $field;
    if (array_key_exists($field['type'], $field_types)) {
      $field['module'] = $module;
      $field['active'] = 1;
    }
    if (array_key_exists($field['storage']['type'], $storage_types)) {
      $field['storage']['module'] = $module;
      $field['storage']['active'] = 1;
    }
    if ($old_field !== $field) {
      field_update_field($field);
    }
  }
}