get_random_id ()

In some situations it can be very useful to generate a unique ID in templates. This is particularly useful when creating templates for the Flow system and you need unique IDs for the DOM.

Example

{% set id = get_random_id() %}
<div id="{{ id }}">
  <button data-target="{{ id }}" class="toggle">Hide This</button>
</div>

Comments