diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php
index 9cd17b0..ab69cb9 100644
--- a/core/lib/Drupal/Core/Template/TwigExtension.php
+++ b/core/lib/Drupal/Core/Template/TwigExtension.php
@@ -18,14 +18,12 @@
*/
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'),
+ // 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 +51,6 @@ public function getNodeVisitors() {
public function getTokenParsers() {
return array(
- new TwigFunctionTokenParser('hide'),
- new TwigFunctionTokenParser('show'),
new TwigTransTokenParser(),
);
}
diff --git a/core/modules/block/block.module b/core/modules/block/block.module
index e1bc631..b25fd17 100644
--- a/core/modules/block/block.module
+++ b/core/modules/block/block.module
@@ -407,6 +407,20 @@ function block_list($region) {
}
/**
+ * Prepares variables for block list templates.
+ *
+ * Default template: block-list.html.twig.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - form: A render element representing the form.
+ */
+function template_preprocess_block_list(&$variables) {
+ $variables['place_blocks'] = $variables['form']['place_blocks'];
+ unset($variables['form']['place_blocks']);
+}
+
+/**
* Loads a block instance.
*
* This should only be used when entity_load() cannot be used directly.
diff --git a/core/modules/block/templates/block-list.html.twig b/core/modules/block/templates/block-list.html.twig
index 873d192..1900146 100644
--- a/core/modules/block/templates/block-list.html.twig
+++ b/core/modules/block/templates/block-list.html.twig
@@ -9,16 +9,16 @@
*
* Available variables:
* - form: The block add/edit form.
+ * - place_blocks: The list and filter form elements to place blocks.
*
* @ingroup themeable
*/
#}
-{% hide(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..de9fc87 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,6 @@
- {# We hide the links now so that we can render them later. #}
- {% hide(content.links) %}
{{ content }}
{% if signature %}
@@ -102,5 +99,5 @@
diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig
index 1f8c823..67547ce 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,10 @@
{% endif %}
- {# We hide links now so that we can render them later. #}
- {% hide(content.links) %}
{{ content }}
-
- {{ content.links }}
+ {% if links %}
+ {{ links }}
+ {% endif %}
diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module
index 08cd24c..68033df 100644
--- a/core/modules/rdf/rdf.module
+++ b/core/modules/rdf/rdf.module
@@ -318,7 +318,7 @@ function rdf_preprocess_node(&$variables) {
foreach ($valid_fields as $field_name) {
$count += $variables['node']->get($field_name)->comment_count;
// Annotates the 'x comments' link in teaser view.
- if (isset($variables['content']['links']['comment__' . $field_name]['#links']['comment-comments'])) {
+ if (isset($variables['links']['comment__' . $field_name]['#links']['comment-comments'])) {
$comment_count_attributes = rdf_rdfa_attributes($comment_count_mapping, $variables['node']->get($field_name)->comment_count);
// According to RDFa parsing rule number 4, a new subject URI is created
// from the href attribute if no rel/rev attribute is present. To get
@@ -326,7 +326,7 @@ function rdf_preprocess_node(&$variables) {
// container we set an empty rel attribute which triggers rule number 5.
// See http://www.w3.org/TR/rdfa-syntax/#sec_5.5.
$comment_count_attributes['rel'] = '';
- $variables['content']['links']['comment__' . $field_name]['#links']['comment-comments']['attributes'] += $comment_count_attributes;
+ $variables['links']['comment__' . $field_name]['#links']['comment-comments']['attributes'] += $comment_count_attributes;
}
}
// In full node view, the number of comments is not displayed by
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/bartik.theme b/core/themes/bartik/bartik.theme
index e334125..326a1b0 100644
--- a/core/themes/bartik/bartik.theme
+++ b/core/themes/bartik/bartik.theme
@@ -154,7 +154,7 @@ function bartik_preprocess_node(&$variables) {
// Remove the "Add new comment" link on teasers or when the comment form is
// displayed on the page.
if ($variables['teaser'] || !empty($variables['content']['comments']['comment_form'])) {
- unset($variables['content']['links']['comment']['#links']['comment-add']);
+ unset($variables['links']['comment']['#links']['comment-add']);
}
}
diff --git a/core/themes/bartik/templates/comment.html.twig b/core/themes/bartik/templates/comment.html.twig
index ad03eb6..0d8948d 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,6 @@
{{ title_suffix }}
- {# We hide the links now so that we can render them later. #}
- {% hide(content.links) %}
{{ content }}
@@ -119,7 +116,7 @@
{% endif %}
diff --git a/core/themes/bartik/templates/node.html.twig b/core/themes/bartik/templates/node.html.twig
index 6694211..ea821fd 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,12 @@
- {# We hide links now so that we can render them later. #}
- {% hide(content.links) %}
{{ content }}
- {% if content.links %}
+ {% if links %}
{% endif %}