commit 4870cc6d50c869b0a2d5f882ad7a3cdba1676100 Author: Joel Pittet Date: Thu Apr 3 19:58:10 2014 -0700 no more printed state diff --git a/core/lib/Drupal/Core/Template/Attribute.php b/core/lib/Drupal/Core/Template/Attribute.php index 7833acc..ead5d05 100644 --- a/core/lib/Drupal/Core/Template/Attribute.php +++ b/core/lib/Drupal/Core/Template/Attribute.php @@ -112,11 +112,9 @@ public function offsetExists($name) { public function __toString() { $return = ''; foreach ($this->storage as $name => $value) { - if (!$value->printed()) { - $rendered = $value->render(); - if ($rendered) { - $return .= ' ' . $rendered; - } + $rendered = $value->render(); + if ($rendered) { + $return .= ' ' . $rendered; } } return $return; diff --git a/core/lib/Drupal/Core/Template/AttributeArray.php b/core/lib/Drupal/Core/Template/AttributeArray.php index 38f216f..95e0ef3 100644 --- a/core/lib/Drupal/Core/Template/AttributeArray.php +++ b/core/lib/Drupal/Core/Template/AttributeArray.php @@ -66,7 +66,6 @@ public function offsetExists($offset) { * Implements the magic __toString() method. */ public function __toString() { - $this->printed = TRUE; return String::checkPlain(implode(' ', $this->value)); } diff --git a/core/lib/Drupal/Core/Template/AttributeBoolean.php b/core/lib/Drupal/Core/Template/AttributeBoolean.php index db444fd..4e9ea67 100644 --- a/core/lib/Drupal/Core/Template/AttributeBoolean.php +++ b/core/lib/Drupal/Core/Template/AttributeBoolean.php @@ -42,7 +42,6 @@ public function render() { * Implements the magic __toString() method. */ public function __toString() { - $this->printed = TRUE; return $this->value === FALSE ? '' : String::checkPlain($this->name); } diff --git a/core/lib/Drupal/Core/Template/AttributeString.php b/core/lib/Drupal/Core/Template/AttributeString.php index a2a5514..07211be 100644 --- a/core/lib/Drupal/Core/Template/AttributeString.php +++ b/core/lib/Drupal/Core/Template/AttributeString.php @@ -30,7 +30,6 @@ class AttributeString extends AttributeValueBase { * Implements the magic __toString() method. */ public function __toString() { - $this->printed = TRUE; return String::checkPlain($this->value); } diff --git a/core/lib/Drupal/Core/Template/AttributeValueBase.php b/core/lib/Drupal/Core/Template/AttributeValueBase.php index 6ccd339..73e6bee 100644 --- a/core/lib/Drupal/Core/Template/AttributeValueBase.php +++ b/core/lib/Drupal/Core/Template/AttributeValueBase.php @@ -17,13 +17,6 @@ abstract class AttributeValueBase { /** - * Whether this attribute hsa been printed already. - * - * @var bool - */ - protected $printed = FALSE; - - /** * The value itself. * * @var mixed @@ -61,16 +54,6 @@ public function render() { } /** - * Whether this attribute hsa been printed already. - * - * @return bool - * TRUE if this attribute has been printed, FALSE otherwise. - */ - public function printed() { - return $this->printed; - } - - /** * Implements the magic __toString() method. */ abstract function __toString(); diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigFilterTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigFilterTest.php index 42be0c1..9b514d7 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigFilterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigFilterTest.php @@ -50,7 +50,6 @@ public function testTwigWithoutFilter() { 'class' => array('red', 'green', 'blue'), ), ); - $rendered = drupal_render($filter_test); $this->drupalSetContent($rendered); diff --git a/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.filter.html.twig b/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.filter.html.twig index 308e9f4..28e5c15 100644 --- a/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.filter.html.twig +++ b/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.filter.html.twig @@ -16,7 +16,7 @@
Class attributes in front, remainder at the back:
Class attributes in back, remainder at the front:
Class attributes only:
-
Without boolean attribute.
+
Without boolean attribute.
Without string attribute.
Without either nor class attributes.
All attributes again.
diff --git a/core/themes/engines/twig/twig.engine b/core/themes/engines/twig/twig.engine index d596715..1595bf8 100644 --- a/core/themes/engines/twig/twig.engine +++ b/core/themes/engines/twig/twig.engine @@ -164,7 +164,12 @@ function twig_render_var($arg) { * The filtered renderable array. */ function twig_without($element) { - $filtered_element = $element; + if ($element instanceof ArrayAccess) { + $filtered_element = clone $element; + } + else { + $filtered_element = $element; + } $args = func_get_args(); unset($args[0]); foreach ($args as $arg) {