By nickdickinsonwilde on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.7.x
Introduced in version:
8.7.0
Issue links:
Description:
Summary
The Drupal specific twig filter function without has been moved from being implemented by the procedural twig_without() function to the without() method in \Drupal\Core\Template\TwigExtension.
Usage of the without filter in twig templates is unaffected, however the twig_without function is deprecated and will be removed prior to 9.0.0.
Before
$filtered_element = twig_without($element, 'key_to_remove', 'key_to_remove_n');
After
/** @var \Drupal\Core\Template\TwigExtension $extension */
$extension = \Drupal::service('twig.extension');
$filtered_element = $extension->without($element, 'key_to_remove', 'key_to_remove_n');
Impacts:
Module developers
Themers