You are here

function entity_translation_field_info_alter in Entity Translation 7

Implements hook_field_info_alter().

File

./entity_translation.module, line 1006

Code

function entity_translation_field_info_alter(&$info) {
  $columns = array(
    'fid',
  );
  $supported_types = array(
    'file' => $columns,
    'image' => $columns,
  );
  foreach ($info as $field_type => &$field_type_info) {

    // Store columns to be synchronized.
    if (!isset($field_type_info['settings'])) {
      $field_type_info['settings'] = array();
    }
    $field_type_info['settings'] += array(
      'entity_translation_sync' => isset($supported_types[$field_type]) ? $supported_types[$field_type] : FALSE,
    );

    // Synchronization can be enabled per instance.
    if (!isset($field_type_info['instance_settings'])) {
      $field_type_info['instance_settings'] = array();
    }
    $field_type_info['instance_settings'] += array(
      'entity_translation_sync' => FALSE,
    );
  }
}