Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

Summary

The Drupal-specific show() and hide() functions have been removed from Twig templates and replaced with a new without Twig filter. Render arrays are no longer tracked as being printed or not within the context of Twig templates, they can be printed multiple times and the without filter can be used to exclude child elements of the render array from being printed.

show() and hide() are still available in PHP (inside preprocess functions, for example). Internally, removing these functions from Twig allowed for the removal of Drupal-specific Twig extensions for passing around variables as references.

Before

<div{{ content_attributes }}>
  {% hide(content.links) %}
  {{ content }}
</div>

{{ content.links }}

After

<div{{ content_attributes }}>
  {{ content|without('links') }}
</div>

{{ content.links }}

You can also hide multiple elements:

{{ form|without('advanced', 'actions') }}
Impacts: 
Module developers
Themers