dsfr4drupal-1.x-dev/templates/form/captcha.html.twig
templates/form/captcha.html.twig
{%
set classes = [
'captcha',
('captcha-type-challenge--' ~ element['#captcha_type_challenge'])|clean_class,
]
%}
{% set legend_classes = [
'fr-fieldset__legend',
'fr-text--regular',
'js-form-required',
'form-required',
] %}
{% block captcha %}
{% if is_visible %}
{% block captcha_display %}
{% if title is not empty %}
<fieldset {{ attributes.addClass(classes).addClass('fr-fieldset') }}>
<legend class="{{ legend_classes|join(' ') }}">
{{ title }}
{% if description is not empty %}
{% if description_tooltip %}
{{ include('dsfr4drupal:tooltip', {
'title': tooltip_title|default('Help text'|t),
'tooltip': description,
}, with_context=false) }}
{% else %}
<span class="fr-hint-text">{{ description }}</span>
{% endif %}
{% endif %}
</legend>
{% else %}
<div {{ attributes.addClass(classes) }}>
{% if description is not empty %}
<p class="fr-hint-text">{{ description }}</p>
{% endif %}
{% endif %}
<div class="captcha__element">
{{ element }}
</div>
{% if title is not empty %}
</fieldset>
{% else %}
</div>
{% endif %}
{% endblock %}
{% else %}
{# Required for _captcha_required_for_user() to preserve the hidden fields
in the form even though the CAPTCHA is not visible. #}
{{ element }}
{% endif %}
{% endblock %}
