function text_field_prepare_translation

Implements hook_field_prepare_translation().

File

modules/field/modules/text/text.module, line 594

Code

function text_field_prepare_translation($entity_type, $entity, $field, $instance, $langcode, &$items, $source_entity, $source_langcode) {
    // If the translating user is not permitted to use the assigned text format,
    // we must not expose the source values.
    $field_name = $field['field_name'];
    if (!empty($source_entity->{$field_name}[$source_langcode])) {
        $formats = filter_formats();
        foreach ($source_entity->{$field_name}[$source_langcode] as $delta => $item) {
            $format_id = $item['format'];
            if (!empty($format_id) && !filter_access($formats[$format_id])) {
                unset($items[$delta]);
            }
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.