8000 Add an id to the help · symfony/symfony@058489d · GitHub
[go: up one dir, main page]

Skip to content

Commit 058489d

Browse files
Mathieu Piotmpiot
Mathieu Piot
authored andcommitted
Add an id to the help
1 parent 6ea7a20 commit 058489d

File tree

7 files changed

+7
-4
lines changed

7 files changed

+7
-4
lines changed

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,6 @@
155155

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

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,6 @@
282282

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

src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@
291291

292292
{% block form_help -%}
293293
{% if help is not empty %}
294-
<p class="help-text">{{ translation_domain is same as(false) ? help : help|trans({}, translation_domain) }}</p>
294+
<p id="{{ id }}_help" class="help-text">{{ translation_domain is same as(false) ? help : help|trans({}, translation_domain) }}</p>
295295
{% endif %}
296296
{%- endblock form_help %}
297297

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<?php if (!empty($help)): ?>
2-
<p class="help-text"><?php echo $view->escape(false !== $translation_domain ? $view['translator']->trans($help, array(), $translation_domain) : $help) ?></p>
2+
<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>
33
<?php endif ?>

src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public function testHelp()
112112

113113
$this->assertMatchesXpath($html,
114114
'/span
115+
[@id="name_help"]
115116
[@class="help-block"]
116117
[.="[trans]Help text test![/trans]"]
117118
'

src/Symfony/Component/Form/Tests/AbstractBootstrap4LayoutTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ public function testHelp()
161161

162162
$this->assertMatchesXpath($html,
163163
'/small
164+
[@id="name_help"]
164165
[@class="form-text text-muted"]
165166
[.="[trans]Help text test![/trans]"]
166167
'

src/Symfony/Component/Form/Tests/AbstractLayoutTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ public function testHelp()
420420

421421
$this->assertMatchesXpath($html,
422422
'/p
423+
[@id="name_help"]
423424
[@class="help-text"]
424425
[.="[trans]Help text test![/trans]"]
425426
'

0 commit comments

Comments
 (0)
0