diff --git a/core/includes/common.inc b/core/includes/common.inc index 0dbabd8484e3155e04ff8ef5b5b28f78f2c32bdb..eb7362cb473c603e8878fb13142d6df9a0238714 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -3916,7 +3916,7 @@ function drupal_render(&$elements) { // only this theme() call. This allows #theme hooks and #theme_wrappers // hooks to share variable names without conflict or ambiguity. $wrapper_elements = $elements; - if (is_array($value)) { + if (is_string($key)) { $wrapper_hook = $key; foreach ($value as $attribute => $override) { $wrapper_elements[$attribute] = $override; diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php index 17993432ad4437511c25a7fcf2ae071667a9b79d..be4d7e533f030e900bbbf0ae5006fc5a295e1729 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php @@ -134,6 +134,15 @@ function testDrupalRenderBasics() { ), 'expected' => '
', ), + // Array syntax theme hook suggestion in #theme_wrappers. + array( + 'name' => '#theme_wrappers implements an array style theme hook suggestion', + 'value' => array( + '#theme_wrappers' => array(array('container')), + '#attributes' => array('class' => 'foo'), + ), + 'expected' => '
', + ), // Test handling of #markup as a fallback for #theme hooks. // Simple #markup with no theme.