diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php index 9cd17b0..0631a28 100644 --- a/core/lib/Drupal/Core/Template/TwigExtension.php +++ b/core/lib/Drupal/Core/Template/TwigExtension.php @@ -23,9 +23,7 @@ public function getFunctions() { // @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'), 'render_var' => new TwigReferenceFunction('twig_render_var'), - 'show' => new TwigReferenceFunction('twig_show'), ); } @@ -40,6 +38,7 @@ public function getFilters() { // @see TwigNodeTrans::compileString() 'passthrough' => new \Twig_Filter_Function('twig_raw_filter'), 'placeholder' => new \Twig_Filter_Function('twig_raw_filter'), + 'without' => new \Twig_Filter_Function('twig_without'), ); } @@ -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..474c654 100644 --- a/core/modules/block/templates/block-list.html.twig +++ b/core/modules/block/templates/block-list.html.twig @@ -13,10 +13,9 @@ * @ingroup themeable */ #} -{% hide(form.place_blocks) %}
- {{ form }} + {{ form|without('place_blocks') }}
{{ form.place_blocks }} diff --git a/core/modules/comment/templates/comment.html.twig b/core/modules/comment/templates/comment.html.twig index 570448f..c26b4b6 100644 --- a/core/modules/comment/templates/comment.html.twig +++ b/core/modules/comment/templates/comment.html.twig @@ -7,8 +7,11 @@ * - 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 }}. Use following code to temporarily suppress the + * printing of a given child element: + * @code + * {{ content|without('field_example') }} + * @endcode * - 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. @@ -93,8 +96,7 @@ {# We hide the links now so that we can render them later. #} - {% hide(content.links) %} - {{ content }} + {{ content|without('links') }} {% if signature %}
diff --git a/core/modules/node/templates/node-edit-form.html.twig b/core/modules/node/templates/node-edit-form.html.twig index eee9ecc..c208cf5 100644 --- a/core/modules/node/templates/node-edit-form.html.twig +++ b/core/modules/node/templates/node-edit-form.html.twig @@ -15,11 +15,9 @@ * @ingroup themeable */ #} -{% hide(form.advanced) %} -{% hide(form.actions) %}
- {{ form }} + {{ form|without('advanced', 'actions') }}
{{ form.advanced }} diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index 1f8c823..55d5589 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -18,8 +18,8 @@ * - 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. + * {{ content|without('field_example') %} to temporarily suppress the printing + * of a given child element. * - 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 @@ -94,8 +94,7 @@ {# We hide links now so that we can render them later. #} - {% hide(content.links) %} - {{ content }} + {{ content|without('links') }}
{{ content.links }} diff --git a/core/modules/taxonomy/templates/taxonomy-term.html.twig b/core/modules/taxonomy/templates/taxonomy-term.html.twig index a3986fa..2ecc713 100644 --- a/core/modules/taxonomy/templates/taxonomy-term.html.twig +++ b/core/modules/taxonomy/templates/taxonomy-term.html.twig @@ -8,10 +8,10 @@ * - 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: + * 'content.description'. Use the following code to exclude the + * printing of a given child element: * @code - * {% hide(content.description) %} + * {{ content|without('description') }} * @endcode * - attributes: HTML attributes for the wrapper. The 'class' attribute * contains the following classes by default: diff --git a/core/themes/bartik/templates/comment.html.twig b/core/themes/bartik/templates/comment.html.twig index ad03eb6..cfc56f6 100644 --- a/core/themes/bartik/templates/comment.html.twig +++ b/core/themes/bartik/templates/comment.html.twig @@ -7,8 +7,11 @@ * - 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 }}. Use following code to temporarily suppress the + * printing of a given child element: + * @code + * {{ content|without('field_example') }} + * @endcode * - 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. @@ -107,8 +110,7 @@ {# We hide the links now so that we can render them later. #} - {% hide(content.links) %} - {{ content }} + {{ content|without('links') }}