field_sync_field_status

  1. drupal
    1. 8
    2. 7
Versions
8 – 7 field_sync_field_status()

Refreshes the 'active' and 'storage_active' columns for fields.

Related topics

Code

modules/field/field.module, line 430

<?php
function field_sync_field_status() {
  // Refresh the 'active' and 'storage_active' columns according to the current
  // set of enabled modules.
  $all_modules = system_rebuild_module_data();
  $modules = array();
  foreach ($all_modules as $module_name => $module) {
    if ($module->status) {
      $modules[] = $module_name;
      field_associate_fields($module_name);
    }
  }
  db_update('field_config')
    ->fields(array('active' => 0))
    ->condition('module', $modules, 'NOT IN')
    ->execute();
  db_update('field_config')
    ->fields(array('storage_active' => 0))
    ->condition('storage_module', $modules, 'NOT IN')
    ->execute();
}
?>