From 9ede9f0f71d86ff618e815486d319505ebb0cc6b Mon Sep 17 00:00:00 2001 From: Axel Rutz Date: Sat, 4 Jan 2014 01:07:22 +0100 Subject: [PATCH] Fixed #2103079: Rules metadata assertions for list types broken --- includes/rules.state.inc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/includes/rules.state.inc b/includes/rules.state.inc index a4150e7..43871f4 100644 --- a/includes/rules.state.inc +++ b/includes/rules.state.inc @@ -508,11 +508,16 @@ class RulesData { // before the child-wrapper is created. if (count($parts) == 1) { // Support asserting a type in case of generic entity references only. - if (isset($assertion['type']) && $var_info[$parts[0]]['type'] == 'entity') { - if (entity_get_info($assertion['type'])) { - $var_info[$parts[0]]['type'] = $assertion['type']; + if (isset($assertion['type'])) { + $is_list_type = preg_match('/list<(.*)>/', $assertion['type'], $matches); + $basic_type = $is_list_type ? $matches[1] : $assertion['type']; + $generic_type = $is_list_type ? 'list' : 'entity'; + if ($var_info[$parts[0]]['type'] == $generic_type) { + if (entity_get_info($basic_type)) { + $var_info[$parts[0]]['type'] = $assertion['type']; + } + unset($assertion['type']); } - unset($assertion['type']); } // Add any single bundle directly to the variable info, so the // variable fits as argument for parameters requiring the bundle. -- 1.7.9.5