[TwigBridge][Form] Added missing help messages in form themes
This commit is contained in:
parent
8855082ffd
commit
5374d4f210
@ -64,6 +64,7 @@ col-sm-10
|
|||||||
<div class="{{ block('form_label_class') }}"></div>{#--#}
|
<div class="{{ block('form_label_class') }}"></div>{#--#}
|
||||||
<div class="{{ block('form_group_class') }}">
|
<div class="{{ block('form_group_class') }}">
|
||||||
{{- form_widget(form) -}}
|
{{- form_widget(form) -}}
|
||||||
|
{{- form_help(form) -}}
|
||||||
{{- form_errors(form) -}}
|
{{- form_errors(form) -}}
|
||||||
</div>{#--#}
|
</div>{#--#}
|
||||||
</div>
|
</div>
|
||||||
|
@ -148,6 +148,7 @@
|
|||||||
{% block checkbox_row -%}
|
{% block checkbox_row -%}
|
||||||
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ (not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
|
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ (not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
|
||||||
{{- form_widget(form) -}}
|
{{- form_widget(form) -}}
|
||||||
|
{{- form_help(form) -}}
|
||||||
{{- form_errors(form) -}}
|
{{- form_errors(form) -}}
|
||||||
</div>
|
</div>
|
||||||
{%- endblock checkbox_row %}
|
{%- endblock checkbox_row %}
|
||||||
@ -155,6 +156,7 @@
|
|||||||
{% block radio_row -%}
|
{% block radio_row -%}
|
||||||
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ (not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
|
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ (not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
|
||||||
{{- form_widget(form) -}}
|
{{- form_widget(form) -}}
|
||||||
|
{{- form_help(form) -}}
|
||||||
{{- form_errors(form) -}}
|
{{- form_errors(form) -}}
|
||||||
</div>
|
</div>
|
||||||
{%- endblock radio_row %}
|
{%- endblock radio_row %}
|
||||||
|
@ -311,6 +311,7 @@
|
|||||||
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' row')|trim})} %}{{ block('attributes') }}{% endwith %}>
|
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' row')|trim})} %}{{ block('attributes') }}{% endwith %}>
|
||||||
<div class="large-12 columns{% if not valid %} error{% endif %}">
|
<div class="large-12 columns{% if not valid %} error{% endif %}">
|
||||||
{{ form_widget(form) }}
|
{{ form_widget(form) }}
|
||||||
|
{{- form_help(form) -}}
|
||||||
{{ form_errors(form) }}
|
{{ form_errors(form) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -320,6 +321,7 @@
|
|||||||
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' row')|trim})} %}{{ block('attributes') }}{% endwith %}>
|
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' row')|trim})} %}{{ block('attributes') }}{% endwith %}>
|
||||||
<div class="large-12 columns{% if not valid %} error{% endif %}">
|
<div class="large-12 columns{% if not valid %} error{% endif %}">
|
||||||
{{ form_widget(form) }}
|
{{ form_widget(form) }}
|
||||||
|
{{- form_help(form) -}}
|
||||||
{{ form_errors(form) }}
|
{{ form_errors(form) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -163,4 +163,23 @@ abstract class AbstractBootstrap3HorizontalLayoutTest extends AbstractBootstrap3
|
|||||||
|
|
||||||
$this->assertMatchesXpath($html, '/div[@class="form-group"]/div[@class="col-sm-2" or @class="col-sm-10"]', 2);
|
$this->assertMatchesXpath($html, '/div[@class="form-group"]/div[@class="col-sm-2" or @class="col-sm-10"]', 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCheckboxRowWithHelp()
|
||||||
|
{
|
||||||
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType');
|
||||||
|
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);
|
||||||
|
|
||||||
|
$this->assertMatchesXpath($html,
|
||||||
|
'/div
|
||||||
|
[@class="form-group"]
|
||||||
|
[
|
||||||
|
./div[@class="col-sm-2" or @class="col-sm-10"]
|
||||||
|
/following-sibling::div[@class="col-sm-2" or @class="col-sm-10"]
|
||||||
|
[
|
||||||
|
./span[text() = "[trans]really helpful text[/trans]"]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,6 +333,21 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCheckboxRowWithHelp()
|
||||||
|
{
|
||||||
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType');
|
||||||
|
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);
|
||||||
|
|
||||||
|
$this->assertMatchesXpath($html,
|
||||||
|
'/div
|
||||||
|
[@class="form-group"]
|
||||||
|
[
|
||||||
|
./span[text() = "[trans]really helpful text[/trans]"]
|
||||||
|
]
|
||||||
|
'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testSingleChoice()
|
public function testSingleChoice()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', [
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', [
|
||||||
@ -2277,6 +2292,21 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testRadioRowWithHelp()
|
||||||
|
{
|
||||||
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false);
|
||||||
|
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);
|
||||||
|
|
||||||
|
$this->assertMatchesXpath($html,
|
||||||
|
'/div
|
||||||
|
[@class="form-group"]
|
||||||
|
[
|
||||||
|
./span[text() = "[trans]really helpful text[/trans]"]
|
||||||
|
]
|
||||||
|
'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testRange()
|
public function testRange()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RangeType', 42, ['attr' => ['min' => 5]]);
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RangeType', 42, ['attr' => ['min' => 5]]);
|
||||||
|
@ -231,6 +231,25 @@ abstract class AbstractBootstrap4HorizontalLayoutTest extends AbstractBootstrap4
|
|||||||
./small[text() = "[trans]really helpful text[/trans]"]
|
./small[text() = "[trans]really helpful text[/trans]"]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRadioRowWithHelp()
|
||||||
|
{
|
||||||
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false);
|
||||||
|
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);
|
||||||
|
|
||||||
|
$this->assertMatchesXpath($html,
|
||||||
|
'/div
|
||||||
|
[@class="form-group row"]
|
||||||
|
[
|
||||||
|
./div[@class="col-sm-2" or @class="col-sm-10"]
|
||||||
|
/following-sibling::div[@class="col-sm-2" or @class="col-sm-10"]
|
||||||
|
[
|
||||||
|
./small[text() = "[trans]really helpful text[/trans]"]
|
||||||
|
]
|
||||||
|
]
|
||||||
'
|
'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -422,6 +422,21 @@ abstract class AbstractBootstrap4LayoutTest extends AbstractBootstrap3LayoutTest
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCheckboxRowWithHelp()
|
||||||
|
{
|
||||||
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType');
|
||||||
|
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);
|
||||||
|
|
||||||
|
$this->assertMatchesXpath($html,
|
||||||
|
'/div
|
||||||
|
[@class="form-group"]
|
||||||
|
[
|
||||||
|
./small[text() = "[trans]really helpful text[/trans]"]
|
||||||
|
]
|
||||||
|
'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testSingleChoiceExpanded()
|
public function testSingleChoiceExpanded()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamed('name', ChoiceType::class, '&a', [
|
$form = $this->factory->createNamed('name', ChoiceType::class, '&a', [
|
||||||
@ -1027,6 +1042,21 @@ abstract class AbstractBootstrap4LayoutTest extends AbstractBootstrap3LayoutTest
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testRadioRowWithHelp()
|
||||||
|
{
|
||||||
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false);
|
||||||
|
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);
|
||||||
|
|
||||||
|
$this->assertMatchesXpath($html,
|
||||||
|
'/div
|
||||||
|
[@class="form-group"]
|
||||||
|
[
|
||||||
|
./small[text() = "[trans]really helpful text[/trans]"]
|
||||||
|
]
|
||||||
|
'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testButtonAttributeNameRepeatedIfTrue()
|
public function testButtonAttributeNameRepeatedIfTrue()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamed('button', ButtonType::class, null, [
|
$form = $this->factory->createNamed('button', ButtonType::class, null, [
|
||||||
|
Reference in New Issue
Block a user