function entity2text_tokens in Entity To Text 7
Implements hook_tokens().
Replace tokens created by this module with Entity rendered as text for the View Mode
File
- ./
entity2text.module, line 42
Code
function entity2text_tokens($type, $tokens, array $data = array(), array $options = array()) {
$replacements = array();
$entity_types = array_keys(entity_get_info());
if (in_array($type, $entity_types)) {
foreach ($tokens as $token_key => $value) {
$token_parts = explode('-', $token_key);
if ($token_parts[0] == 'textexport') {
//created by this module
$view_mode = $token_parts[1];
$entity_type = $type;
$entity = $data[$type];
$rendered_text = entity2text_render_entity_to_text($entity_type, $entity, $view_mode);
$replacements[$value] = $rendered_text;
}
}
}
return $replacements;
}