1 field.module field_sync_field_status()

Refreshes the 'active' and 'storage[active]' properties on fields.

Related topics

File

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

Code

function field_sync_field_status() {
  // Refresh the 'active' and 'storage_active' columns according to the current
  // set of enabled modules.
  $modules = module_list();
  foreach ($modules as $module_name) {
    field_associate_fields($module_name);
  }

  $fields = field_read_fields(array(), array('include_inactive' => TRUE, 'include_deleted' => TRUE));
  foreach ($fields as $field) {
    $current_field = $field;
    $field['active'] = (int) in_array($field['module'], $modules);
    $field['storage']['active'] = (int) in_array($field['storage']['module'], $modules);
    if ($current_field !== $field) {
      field_update_field($field);
    }
  }
}