function token_field_field_load in Token Field 7
Implements hook_field().
File
- ./
token_field.module, line 75 - Optional extension to CCK (Content Construction Kit) to provide a read-only field which allows embedding of "compound" fields using Tokens.
Code
function token_field_field_load($entity_type, $entities, $field, $instances, $landcode, &$items) {
foreach ($entities as $id => $entity) {
// Get the template from the field and overly the defaults
$item = $field['settings']['template'] + array(
'value' => '',
'format' => filter_default_format(),
);
// Parse the body for tokens
$types = array(
'global' => NULL,
$entity_type => $entity,
);
$item['value_token_filtered'] = token_replace($item['value'], $types);
$item['safe'] = check_markup($item['value_token_filtered'], $item['format']);
$items[$id][0] = $item;
}
}