Chris@0: /** Chris@0: * Implements hook_field_load(). Chris@0: */ Chris@0: function {{ machine_name }}_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) { Chris@0: // Sample code from text.module: precompute sanitized strings so they are Chris@0: // stored in the field cache. Chris@0: foreach ($entities as $id => $entity) { Chris@0: foreach ($items[$id] as $delta => $item) { Chris@0: // Only process items with a cacheable format, the rest will be handled Chris@0: // by formatters if needed. Chris@0: if (empty($instances[$id]['settings']['text_processing']) || filter_format_allowcache($item['format'])) { Chris@0: $items[$id][$delta]['safe_value'] = isset($item['value']) ? _text_sanitize($instances[$id], $langcode, $item, 'value') : ''; Chris@0: if ($field['type'] == 'text_with_summary') { Chris@0: $items[$id][$delta]['safe_summary'] = isset($item['summary']) ? _text_sanitize($instances[$id], $langcode, $item, 'summary') : ''; Chris@0: } Chris@0: } Chris@0: } Chris@0: } Chris@0: }