You are here

function lingotek_translatable_field_details in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lingotek.util.inc \lingotek_translatable_field_details()
  2. 7.5 lingotek.util.inc \lingotek_translatable_field_details()

Goes though ALL the fields in the system and gets the details about the ones that are marked 'translatable'.

1 call to lingotek_translatable_field_details()
lingotek_translatable_types in ./lingotek.util.inc
Return content types linked to 'translatable' fields for the given entity type.

File

./lingotek.util.inc, line 713
Utility functions.

Code

function lingotek_translatable_field_details() {
  $fields = field_info_fields();
  $translatable_fields = array();
  foreach ($fields as $field_id => $field) {
    foreach ($field['bundles'] as $type => $instance) {
      if (field_is_translatable($type, $field)) {

        //echo '<br>Translatable: YES!' ;
        if (!isset($field['storage']['details']['sql']['FIELD_LOAD_CURRENT'])) {
          LingotekLog::trace("field '{$field_id}' is marked as translatable but does not publish its details.  Skipping.");
          continue;
        }
        $field_db_table = array_keys($field['storage']['details']['sql']['FIELD_LOAD_CURRENT']);
        $field_db_table = array_shift($field_db_table);
        $translatable_fields[$type][] = array(
          'entity_type' => $type,
          'machine_name' => $field['field_name'],
          'db_table' => $field_db_table,
          'bundles' => $field['bundles'][$type],
        );
      }
    }
  }
  return $translatable_fields;
}