field_associate_fields

  1. drupal
    1. 8
    2. 7
Versions
7 – 8 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

▾ 2 functions call field_associate_fields()

field_sync_field_status in modules/field/field.module
Refreshes the 'active' and 'storage_active' columns for fields.
forum_enable in modules/forum/forum.install
Implements hook_enable().

Code

modules/field/field.module, line 457

<?php
function field_associate_fields($module) {
  // Associate field types.
  $field_types = (array) module_invoke($module, 'field_info');
  foreach ($field_types as $name => $field_info) {
    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) {
    db_update('field_config')
      ->fields(array('storage_module' => $module, 'storage_active' => 1))
      ->condition('storage_type', $name)
      ->execute();
  }
}
?>