diff --git a/core/lib/Drupal/Core/Template/TwigNodeTrans.php b/core/lib/Drupal/Core/Template/TwigNodeTrans.php index f905f75..e2f8417 100644 --- a/core/lib/Drupal/Core/Template/TwigNodeTrans.php +++ b/core/lib/Drupal/Core/Template/TwigNodeTrans.php @@ -153,8 +153,23 @@ protected function compileString(\Twig_NodeInterface $body) { $args = $args->getNode('node'); } if ($args instanceof \Twig_Node_Expression_GetAttr) { - $argName = $args->getNode('attribute')->getAttribute('value'); - $expr = $n; + $argName = array(); + // Reuse the incoming expression. + $expr = $args; + // We need to create a valid argument name but we only have the expression. + // Walk through the expression to assemble the correct name. + $argName[] = $args->getNode('attribute')->getAttribute('value'); + while ($args->hasNode('node')) { + $args = $args->getNode('node'); + if ($args instanceof \Twig_Node_Expression_Name) { + $argName[] = $args->getAttribute('name'); + } + else { + $argName[] = $args->getNode('attribute')->getAttribute('value'); + } + } + $argName = array_reverse($argName); + $argName = implode('.', $argName); } else { $argName = $n->getAttribute('name');