fix merge
This commit is contained in:
parent
fd11cc1d0e
commit
7b8acbb0ac
@ -32,65 +32,6 @@
|
||||
{% endif %}
|
||||
{%- endblock money_widget %}
|
||||
|
||||
{% block percent_widget -%}
|
||||
<div class="input-group">
|
||||
{{- block('form_widget_simple') -}}
|
||||
<span class="input-group-addon">%</span>
|
||||
</div>
|
||||
{%- endblock percent_widget %}
|
||||
|
||||
{% block datetime_widget -%}
|
||||
{% if widget == 'single_text' %}
|
||||
{{- block('form_widget_simple') -}}
|
||||
{% else -%}
|
||||
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%}
|
||||
<div {{ block('widget_container_attributes') }}>
|
||||
{{- form_errors(form.date) -}}
|
||||
{{- form_errors(form.time) -}}
|
||||
{{- form_widget(form.date, { datetime: true } ) -}}
|
||||
{{- form_widget(form.time, { datetime: true } ) -}}
|
||||
</div>
|
||||
{%- endif %}
|
||||
{%- endblock datetime_widget %}
|
||||
|
||||
{% block date_widget -%}
|
||||
{% if widget == 'single_text' %}
|
||||
{{- block('form_widget_simple') -}}
|
||||
{% else -%}
|
||||
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%}
|
||||
{% if datetime is not defined or not datetime -%}
|
||||
<div {{ block('widget_container_attributes') -}}>
|
||||
{%- endif %}
|
||||
{{- date_pattern|replace({
|
||||
'{{ year }}': form_widget(form.year),
|
||||
'{{ month }}': form_widget(form.month),
|
||||
'{{ day }}': form_widget(form.day),
|
||||
})|raw -}}
|
||||
{% if datetime is not defined or not datetime -%}
|
||||
</div>
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
{%- endblock date_widget %}
|
||||
|
||||
{% block time_widget -%}
|
||||
{% if widget == 'single_text' %}
|
||||
{{- block('form_widget_simple') -}}
|
||||
{% else -%}
|
||||
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%}
|
||||
{% if datetime is not defined or false == datetime -%}
|
||||
<div {{ block('widget_container_attributes') -}}>
|
||||
{%- endif -%}
|
||||
{{- form_widget(form.hour) }}{% if with_minutes %}:{{ form_widget(form.minute) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second) }}{% endif %}
|
||||
{% if datetime is not defined or false == datetime -%}
|
||||
</div>
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
{%- endblock time_widget %}
|
||||
|
||||
{% block choice_widget_collapsed -%}
|
||||
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) %}
|
||||
{%- endblock choice_widget_collapsed %}
|
||||
|
||||
{% block checkbox_widget -%}
|
||||
{%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%}
|
||||
{% if 'checkbox-inline' in parent_label_class %}
|
||||
|
@ -19,6 +19,7 @@ use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader;
|
||||
use Symfony\Component\Form\FormRenderer;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\Form\Tests\AbstractBootstrap4HorizontalLayoutTest;
|
||||
use Twig\Environment;
|
||||
|
||||
/**
|
||||
* Class providing test cases for the Bootstrap 4 Twig form theme.
|
||||
@ -44,7 +45,7 @@ class FormExtensionBootstrap4HorizontalLayoutTest extends AbstractBootstrap4Hori
|
||||
__DIR__.'/Fixtures/templates/form',
|
||||
));
|
||||
|
||||
$environment = new \Twig_Environment($loader, array('strict_variables' => true));
|
||||
$environment = new Environment($loader, array('strict_variables' => true));
|
||||
$environment->addExtension(new TranslationExtension(new StubTranslator()));
|
||||
$environment->addExtension(new FormExtension());
|
||||
|
||||
|
@ -19,6 +19,7 @@ use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader;
|
||||
use Symfony\Component\Form\FormRenderer;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\Form\Tests\AbstractBootstrap4LayoutTest;
|
||||
use Twig\Environment;
|
||||
|
||||
/**
|
||||
* Class providing test cases for the Bootstrap 4 horizontal Twig form theme.
|
||||
@ -42,7 +43,7 @@ class FormExtensionBootstrap4LayoutTest extends AbstractBootstrap4LayoutTest
|
||||
__DIR__.'/Fixtures/templates/form',
|
||||
));
|
||||
|
||||
$environment = new \Twig_Environment($loader, array('strict_variables' => true));
|
||||
$environment = new Environment($loader, array('strict_variables' => true));
|
||||
$environment->addExtension(new TranslationExtension(new StubTranslator()));
|
||||
$environment->addExtension(new FormExtension());
|
||||
|
||||
@ -78,6 +79,36 @@ class FormExtensionBootstrap4LayoutTest extends AbstractBootstrap4LayoutTest
|
||||
$this->assertSame('<form name="form" method="get" action="0">', $html);
|
||||
}
|
||||
|
||||
public function testMoneyWidgetInIso()
|
||||
{
|
||||
$environment = new Environment(new StubFilesystemLoader(array(
|
||||
__DIR__.'/../../Resources/views/Form',
|
||||
__DIR__.'/Fixtures/templates/form',
|
||||
)), array('strict_variables' => true));
|
||||
$environment->addExtension(new TranslationExtension(new StubTranslator()));
|
||||
$environment->addExtension(new FormExtension());
|
||||
$environment->setCharset('ISO-8859-1');
|
||||
|
||||
$rendererEngine = new TwigRendererEngine(array(
|
||||
'bootstrap_4_layout.html.twig',
|
||||
'custom_widgets.html.twig',
|
||||
), $environment);
|
||||
$this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
|
||||
$this->registerTwigRuntimeLoader($environment, $this->renderer);
|
||||
|
||||
$view = $this->factory
|
||||
->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\MoneyType')
|
||||
->createView()
|
||||
;
|
||||
|
||||
$this->assertSame(<<<'HTML'
|
||||
<div class="input-group"><div class="input-group-prepend">
|
||||
<span class="input-group-text">€ </span>
|
||||
</div><input type="text" id="name" name="name" required="required" class="form-control" /></div>
|
||||
HTML
|
||||
, trim($this->renderWidget($view)));
|
||||
}
|
||||
|
||||
protected function renderForm(FormView $view, array $vars = array())
|
||||
{
|
||||
return (string) $this->renderer->renderBlock($view, 'form', $vars);
|
||||
|
Reference in New Issue
Block a user