Add an id to the help

This commit is contained in:
Mathieu Piot 2018-03-01 06:51:00 +01:00 committed by Mathieu Piot
parent 6ea7a2054b
commit 058489d7df
7 changed files with 7 additions and 4 deletions

View File

@ -155,6 +155,6 @@
{% block form_help -%} {% block form_help -%}
{% if help is not empty %} {% if help is not empty %}
<span class="help-block">{{ translation_domain is same as(false) ? help : help|trans({}, translation_domain) }}</span> <span id="{{ id }}_help" class="help-block">{{ translation_domain is same as(false) ? help : help|trans({}, translation_domain) }}</span>
{% endif %} {% endif %}
{%- endblock form_help %} {%- endblock form_help %}

View File

@ -282,6 +282,6 @@
{% block form_help -%} {% block form_help -%}
{% if help is not empty %} {% if help is not empty %}
<small class="form-text text-muted">{{ translation_domain is same as(false) ? help : help|trans({}, translation_domain) }}</small> <small id="{{ id }}_help" class="form-text text-muted">{{ translation_domain is same as(false) ? help : help|trans({}, translation_domain) }}</small>
{% endif %} {% endif %}
{%- endblock form_help %} {%- endblock form_help %}

View File

@ -291,7 +291,7 @@
{% block form_help -%} {% block form_help -%}
{% if help is not empty %} {% if help is not empty %}
<p class="help-text">{{ translation_domain is same as(false) ? help : help|trans({}, translation_domain) }}</p> <p id="{{ id }}_help" class="help-text">{{ translation_domain is same as(false) ? help : help|trans({}, translation_domain) }}</p>
{% endif %} {% endif %}
{%- endblock form_help %} {%- endblock form_help %}

View File

@ -1,3 +1,3 @@
<?php if (!empty($help)): ?> <?php if (!empty($help)): ?>
<p class="help-text"><?php echo $view->escape(false !== $translation_domain ? $view['translator']->trans($help, array(), $translation_domain) : $help) ?></p> <p id="<?php echo $view->escape($id) ?>_help" class="help-text"><?php echo $view->escape(false !== $translation_domain ? $view['translator']->trans($help, array(), $translation_domain) : $help) ?></p>
<?php endif ?> <?php endif ?>

View File

@ -112,6 +112,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
$this->assertMatchesXpath($html, $this->assertMatchesXpath($html,
'/span '/span
[@id="name_help"]
[@class="help-block"] [@class="help-block"]
[.="[trans]Help text test![/trans]"] [.="[trans]Help text test![/trans]"]
' '

View File

@ -161,6 +161,7 @@ abstract class AbstractBootstrap4LayoutTest extends AbstractBootstrap3LayoutTest
$this->assertMatchesXpath($html, $this->assertMatchesXpath($html,
'/small '/small
[@id="name_help"]
[@class="form-text text-muted"] [@class="form-text text-muted"]
[.="[trans]Help text test![/trans]"] [.="[trans]Help text test![/trans]"]
' '

View File

@ -420,6 +420,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
$this->assertMatchesXpath($html, $this->assertMatchesXpath($html,
'/p '/p
[@id="name_help"]
[@class="help-text"] [@class="help-text"]
[.="[trans]Help text test![/trans]"] [.="[trans]Help text test![/trans]"]
' '