diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php
index 9cd17b0..220d0bc 100644
--- a/core/lib/Drupal/Core/Template/TwigExtension.php
+++ b/core/lib/Drupal/Core/Template/TwigExtension.php
@@ -18,14 +18,13 @@
*/
class TwigExtension extends \Twig_Extension {
public function getFunctions() {
- // @todo re-add unset => twig_unset if this is really needed
return array(
// @todo Remove URL function once http://drupal.org/node/1778610 is resolved.
'url' => new \Twig_Function_Function('url'),
- // These functions will receive a TwigReference object, if a render array is detected
- 'hide' => new TwigReferenceFunction('twig_hide'),
+ 'unset' => new \Twig_Function_Function('unset'),
+ // This functions will receive a TwigReference object, if a
+ // render array is detected
'render_var' => new TwigReferenceFunction('twig_render_var'),
- 'show' => new TwigReferenceFunction('twig_show'),
);
}
@@ -53,8 +52,6 @@ public function getNodeVisitors() {
public function getTokenParsers() {
return array(
- new TwigFunctionTokenParser('hide'),
- new TwigFunctionTokenParser('show'),
new TwigTransTokenParser(),
);
}
diff --git a/core/modules/block/templates/block-list.html.twig b/core/modules/block/templates/block-list.html.twig
index 873d192..cfe1302 100644
--- a/core/modules/block/templates/block-list.html.twig
+++ b/core/modules/block/templates/block-list.html.twig
@@ -13,12 +13,14 @@
* @ingroup themeable
*/
#}
-{% hide(form.place_blocks) %}
+{# We set and unset the place_blocks now so that we can render them later. #}
+{% set place_blocks = form.place_blocks %}
+{% unset(form.place_blocks) %}
{{ form }}
- {{ form.place_blocks }}
+ {{ place_blocks }}
diff --git a/core/modules/comment/templates/comment.html.twig b/core/modules/comment/templates/comment.html.twig
index 570448f..6ebafcb 100644
--- a/core/modules/comment/templates/comment.html.twig
+++ b/core/modules/comment/templates/comment.html.twig
@@ -7,8 +7,7 @@
* - author: Comment author. Can be a link or plain text.
* - content: The content-related items for the comment display. Use
* {{ content }} to print them all, or print a subset such as
- * {{ content.field_example }}. Use hide(content.field_example) to temporarily
- * suppress the printing of a given element.
+ * {{ content.field_example }}.
* - created: Formatted date and time for when the comment was created.
* Preprocess functions can reformat it by calling format_date() with the
* desired parameters on the 'comment.created' variable.
@@ -92,8 +91,9 @@
- {# We hide the links now so that we can render them later. #}
- {% hide(content.links) %}
+ {# We remove links from content to render them later. #}
+ {% set links = content.links %}
+ {% unset(content.links) %}
{{ content }}
{% if signature %}
@@ -102,5 +102,5 @@
diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig
index 1f8c823..9d5b259 100644
--- a/core/modules/node/templates/node.html.twig
+++ b/core/modules/node/templates/node.html.twig
@@ -17,9 +17,7 @@
* - published: Whether the node is published.
* - label: The title of the node.
* - content: All node items. Use {{ content }} to print them all,
- * or print a subset such as {{ content.field_example }}. Use
- * {% hide(content.field_example) %} to temporarily suppress the printing
- * of a given element.
+ * or print a subset such as {{ content.field_example }}.
* - user_picture: The node author's picture from user-picture.html.twig.
* - date: Formatted creation date. Preprocess functions can reformat it by
* calling format_date() with the desired parameters on
@@ -93,11 +91,12 @@
{% endif %}
- {# We hide links now so that we can render them later. #}
- {% hide(content.links) %}
+ {# We remove links now so that we can render them later. #}
+ {% set links = content.links %}
+ {% unset(content.links) %}
{{ content }}
- {{ content.links }}
+ {{ links }}
diff --git a/core/modules/taxonomy/templates/taxonomy-term.html.twig b/core/modules/taxonomy/templates/taxonomy-term.html.twig
index a3986fa..13be3c9 100644
--- a/core/modules/taxonomy/templates/taxonomy-term.html.twig
+++ b/core/modules/taxonomy/templates/taxonomy-term.html.twig
@@ -8,11 +8,7 @@
* - name: Name of the current term.
* - content: Items for the content of the term (fields and description).
* Use 'content' to print them all, or print a subset such as
- * 'content.description'. Use the following code to temporarily suppress the
- * printing of a given element:
- * @code
- * {% hide(content.description) %}
- * @endcode
+ * 'content.description'.
* - attributes: HTML attributes for the wrapper. The 'class' attribute
* contains the following classes by default:
* - taxonomy-term: The current template type, i.e. "theming hook".
diff --git a/core/themes/bartik/templates/comment.html.twig b/core/themes/bartik/templates/comment.html.twig
index ad03eb6..97824e9 100644
--- a/core/themes/bartik/templates/comment.html.twig
+++ b/core/themes/bartik/templates/comment.html.twig
@@ -7,8 +7,7 @@
* - author: Comment author. Can be a link or plain text.
* - content: The content-related items for the comment display. Use
* {{ content }} to print them all, or print a subset such as
- * {{ content.field_example }}. Use hide(content.field_example) to temporarily
- * suppress the printing of a given element.
+ * {{ content.field_example }}.
* - created: Formatted date and time for when the comment was created.
* Preprocess functions can reformat it by calling format_date() with the
* desired parameters on the 'comment.created' variable.
@@ -106,8 +105,9 @@
{{ title_suffix }}
- {# We hide the links now so that we can render them later. #}
- {% hide(content.links) %}
+ {# We remove links from content to render them later. #}
+ {% set links = content.links %}
+ {% unset(content.links) %}
{{ content }}
@@ -119,7 +119,7 @@
{% endif %}
diff --git a/core/themes/bartik/templates/node.html.twig b/core/themes/bartik/templates/node.html.twig
index 6694211..e33fb0b 100644
--- a/core/themes/bartik/templates/node.html.twig
+++ b/core/themes/bartik/templates/node.html.twig
@@ -17,9 +17,7 @@
* - published: Whether the node is published.
* - label: The title of the node.
* - content: All node items. Use {{ content }} to print them all,
- * or print a subset such as {{ content.field_example }}. Use
- * {% hide(content.field_example) %} to temporarily suppress the printing
- * of a given element.
+ * or print a subset such as {{ content.field_example }}.
* - user_picture: The node author's picture from user-picture.html.twig.
* - date: Formatted creation date. Preprocess functions can reformat it by
* calling format_date() with the desired parameters on
@@ -91,14 +89,15 @@
- {# We hide links now so that we can render them later. #}
- {% hide(content.links) %}
+ {# We remove links from content to render them later. #}
+ {% set links = content.links %}
+ {% unset(content.links) %}
{{ content }}