Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By lauriii on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
10.1.x
Introduced in version:
10.1.0
Issue links:
Description:
A new clean_unique_id
Twig filter has been added which can be used for getting a unique ID. The filter ensures that even if the template rendered multiple times, the ID remains unique for each usage.
Example:
<div{{ attributes.setAttribute('id', 'my-id'|clean_unique_id) }}></div>
Impacts:
Module developers
Themers