From 9b7094ae384bbefae71c02a5672d588bfb613e66 Mon Sep 17 00:00:00 2001 From: argiepiano Date: Sun, 5 Jun 2022 14:05:15 -0600 Subject: [PATCH] Issue #37. Fix file field tokens Fixes #37 --- entity_token.tokens.inc | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/entity_token.tokens.inc b/entity_token.tokens.inc index a582546..c5b30cc 100644 --- a/entity_token.tokens.inc +++ b/entity_token.tokens.inc @@ -276,12 +276,7 @@ function entity_token_tokens($type, $tokens, array $data = array(), array $optio if (empty($name_parts[0]) && $name_parts[0] != '0') { continue; } - if ($token_type_from_wrapper == 'file') { - // Get the file object from the wrapper. We send the object (not the wrapper) to core - // file tokens fulfilled in system_tokens(). - $new_data = $wrapper->file->value(); - - } elseif ($token_type_from_wrapper == 'struct') { + if ($token_type_from_wrapper == 'struct') { // If this is a struct we'll pass the wrapper verbatim $new_data = $wrapper; @@ -347,11 +342,6 @@ function entity_token_tokens($type, $tokens, array $data = array(), array $optio // We pass the wrapper to the element. $pass_data = $data[$type]->get($name_parts[0]); break; - - case 'file': - // We need to pass the file object. - $pass_data = $data[$type]->get($name_parts[0])->file->value(); - break; default: // We pass the value, since most likely this is not fulfilled in this module @@ -509,26 +499,19 @@ function _entity_token_get_token_type_from_property_type($field_type) { switch ($field_type) { case 'taxonomy_term': return 'term'; - break; case 'datetime': case 'date': case 'datestamp': return 'date'; - break; - - case 'field_item_file': - return 'file'; - break; case 'text_formatted': case 'field_item_link': + case 'field_item_file': return 'struct'; - break; case 'field_item_image': return 'image'; - break; default: return $field_type;