function globallink_custom_entity_add_fields_config in GlobalLink Connect for Drupal 7.7
File
- globallink_custom_entity/
globallink_custom_entity.inc, line 447
Code
function globallink_custom_entity_add_fields_config($field_arr, $entity, $entity_type) {
//load entity here.
//get all fields associated, check in field config and if not found add them.
$keys = array_keys($field_arr);
foreach ($keys as $field) {
$field_def = field_read_field($field);
if (!globallink_is_field_configured_for_translation($entity_type, $entity->type, $field, $entity->type) && $field_def['translatable'] == 1) {
$allowed = array(
'text',
'entityreference',
' text_with_summary',
'text_long',
'image',
);
if (!in_array($field_def['type'], $allowed)) {
continue;
}
db_insert('globallink_field_config')
->fields(array(
'content_type' => $entity->type,
'entity_type' => $entity_type,
'bundle' => $entity->type,
'field_name' => $field,
'field_type' => $field_def['type'],
'field_label' => $field,
'translatable' => 1,
))
->execute();
}
}
}