text_field_prepare_translation
function text_field_prepare_translation
text_field_prepare_translation($entity_type, $entity, $field, $instance, $langcode, &$items, $source_entity, $source_langcode)
Implements hook_field_prepare_translation().
File
- modules/field/modules/text/text.module, line 586
- Defines simple text field types.
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]); } } } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!field!modules!text!text.module/function/text_field_prepare_translation/7.x