From b0b6787e6cb2a3401cf0280b0cc6c7cac93e5161 Mon Sep 17 00:00:00 2001 From: Michael Caldwell Date: Thu, 2 Nov 2017 13:31:05 -0500 Subject: [PATCH] Issue #2904228 by justcaldwell: Add support for reference fields --- src/Plugin/Condition/NodeField.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Plugin/Condition/NodeField.php b/src/Plugin/Condition/NodeField.php index 5cf84c5..ff9eca1 100644 --- a/src/Plugin/Condition/NodeField.php +++ b/src/Plugin/Condition/NodeField.php @@ -153,7 +153,12 @@ class NodeField extends ConditionPluginBase { // Structured data. if (is_array($value)) { if (!empty($value)) { - $value_to_compare = $value[0]['value']; + // Check for target_id to support references. + if (isset($value[0]['target_id'])) { + $value_to_compare = $value[0]['target_id']; + } else { + $value_to_compare = $value[0]['value']; + } } } // Default. -- 2.13.5 (Apple Git-94)