diff --git a/core/themes/engines/twig/twig.engine b/core/themes/engines/twig/twig.engine index 7242523..3fcd951 100644 --- a/core/themes/engines/twig/twig.engine +++ b/core/themes/engines/twig/twig.engine @@ -131,23 +131,24 @@ function twig_render_var($arg) { } /** - * Sets a child's #printed property to TRUE to prevent it from rendering. + * Removes child elements from a renderable array. * - * @param TwigReference $element - * The parent renderable array to hide the child items. + * @param array $element + * The parent renderable array to exclude the child items. * @param string[] $args,... * The string keys of $element to prevent printing. * - * @return TwigReference - * A TwigReference of a renderable array. + * @return array + * The filtered renderable array. */ -function twig_without(TwigReference $element) { +function twig_without($element) { + $filtered_element = $element; $args = func_get_args(); unset($args[0]); foreach ($args as $arg) { - if (isset($element[$arg])) { - $element[$arg]['#printed'] = TRUE; + if (isset($filtered_element[$arg])) { + unset($filtered_element[$arg]); } } - return $element; + return $filtered_element; }