From 200ca8cd737de1f57e37ce0cb7d73c57a37f2eb7 Mon Sep 17 00:00:00 2001 From: Wolfgang Ziegler // fago Date: Thu, 20 Mar 2014 18:20:08 +0100 Subject: [PATCH] Issue #1440928 by yannickoo, firfin, gudm.d.haralds | Hendry Lee: Entity tokens for multi-value fields can produce a fatal error. --- entity_token.tokens.inc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/entity_token.tokens.inc b/entity_token.tokens.inc index f9ec7f7..77a170d 100644 --- a/entity_token.tokens.inc +++ b/entity_token.tokens.inc @@ -180,9 +180,11 @@ function entity_token_tokens($type, $tokens, array $data = array(), array $optio $wrapper = !isset($wrapper) ? _entity_token_wrap_data($type, $token_types[$type], $data[$type], $options) : $wrapper; $property_name = str_replace('-', '_', $name); try { - $replacement = _entity_token_get_token($wrapper->$property_name, $options); - if (isset($replacement)) { - $replacements[$original] = $replacement; + if (isset($wrapper->$property_name)) { + $replacement = _entity_token_get_token($wrapper->$property_name, $options); + if (isset($replacement)) { + $replacements[$original] = $replacement; + } } } catch (EntityMetadataWrapperException $e) { @@ -294,7 +296,7 @@ function _entity_token_wrap_data($token_type, $type, $data, $options) { */ function _entity_token_get_token($wrapper, $options) { - if ($wrapper->value() === NULL) { + if (!$wrapper || $wrapper->value() === NULL) { // Do not provide a replacement if there is no value. return NULL; } -- GitLab