[Form] Inverted the logic of "single_control" and renamed it to "compound". The opposite is now "simple".
This commit is contained in:
parent
98a7c0cf5f
commit
2e6cdd15c5
@ -310,7 +310,7 @@
|
|||||||
themes.
|
themes.
|
||||||
|
|
||||||
The "field_widget" and all references to it should be renamed to
|
The "field_widget" and all references to it should be renamed to
|
||||||
"form_widget_single_control":
|
"form_widget_simple":
|
||||||
|
|
||||||
Before:
|
Before:
|
||||||
|
|
||||||
@ -329,7 +329,7 @@
|
|||||||
{% block url_widget %}
|
{% block url_widget %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% set type = type|default('url') %}
|
{% set type = type|default('url') %}
|
||||||
{{ block('form_widget_single_control') }}
|
{{ block('form_widget_simple') }}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock url_widget %}
|
{% endblock url_widget %}
|
||||||
```
|
```
|
||||||
@ -337,7 +337,7 @@
|
|||||||
All other "field_*" blocks and references to them should be renamed to
|
All other "field_*" blocks and references to them should be renamed to
|
||||||
"form_*". If you previously defined both a "field_*" and a "form_*"
|
"form_*". If you previously defined both a "field_*" and a "form_*"
|
||||||
block, you can merge them into a single "form_*" block and check the new
|
block, you can merge them into a single "form_*" block and check the new
|
||||||
Boolean variable "single_control":
|
Boolean variable "compound":
|
||||||
|
|
||||||
Before:
|
Before:
|
||||||
|
|
||||||
@ -360,10 +360,10 @@
|
|||||||
```
|
```
|
||||||
{% block form_errors %}
|
{% block form_errors %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% if single_control %}
|
{% if compound %}
|
||||||
... field code ...
|
|
||||||
{% else %}
|
|
||||||
... form code ...
|
... form code ...
|
||||||
|
{% else %}
|
||||||
|
... field code ...
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock form_errors %}
|
{% endblock form_errors %}
|
||||||
@ -487,7 +487,7 @@
|
|||||||
You can access all other methods on the `FormConfigInterface` object instead.
|
You can access all other methods on the `FormConfigInterface` object instead.
|
||||||
|
|
||||||
Instead of `getChildren` and `hasChildren`, you should now use `all` and
|
Instead of `getChildren` and `hasChildren`, you should now use `all` and
|
||||||
`count` instead.
|
`count`.
|
||||||
|
|
||||||
Before:
|
Before:
|
||||||
|
|
||||||
@ -609,7 +609,7 @@
|
|||||||
|
|
||||||
* No options are passed to `getParent()` of `FormTypeInterface` anymore. If
|
* No options are passed to `getParent()` of `FormTypeInterface` anymore. If
|
||||||
you previously dynamically inherited from FormType or FieldType, you can now
|
you previously dynamically inherited from FormType or FieldType, you can now
|
||||||
dynamically set the "single_control" option instead.
|
dynamically set the "compound" option instead.
|
||||||
|
|
||||||
Before:
|
Before:
|
||||||
|
|
||||||
@ -625,12 +625,12 @@
|
|||||||
```
|
```
|
||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||||
{
|
{
|
||||||
$singleControl = function (Options $options) {
|
$compound = function (Options $options) {
|
||||||
return !$options['expanded'];
|
return $options['expanded'];
|
||||||
};
|
};
|
||||||
|
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
'single_control' => $singleControl,
|
'compound' => $compound,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,20 +2,20 @@
|
|||||||
|
|
||||||
{% block form_widget %}
|
{% block form_widget %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% if single_control %}
|
{% if compound %}
|
||||||
{{ block('form_widget_single_control') }}
|
|
||||||
{% else %}
|
|
||||||
{{ block('form_widget_compound') }}
|
{{ block('form_widget_compound') }}
|
||||||
|
{% else %}
|
||||||
|
{{ block('form_widget_simple') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock form_widget %}
|
{% endblock form_widget %}
|
||||||
|
|
||||||
{% block form_widget_single_control %}
|
{% block form_widget_simple %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% set type = type|default('text') %}
|
{% set type = type|default('text') %}
|
||||||
<input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/>
|
<input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/>
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock form_widget_single_control %}
|
{% endblock form_widget_simple %}
|
||||||
|
|
||||||
{% block form_widget_compound %}
|
{% block form_widget_compound %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
@ -112,7 +112,7 @@
|
|||||||
{% block datetime_widget %}
|
{% block datetime_widget %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% if widget == 'single_text' %}
|
{% if widget == 'single_text' %}
|
||||||
{{ block('form_widget_single_control') }}
|
{{ block('form_widget_simple') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<div {{ block('widget_container_attributes') }}>
|
<div {{ block('widget_container_attributes') }}>
|
||||||
{{ form_errors(form.date) }}
|
{{ form_errors(form.date) }}
|
||||||
@ -127,7 +127,7 @@
|
|||||||
{% block date_widget %}
|
{% block date_widget %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% if widget == 'single_text' %}
|
{% if widget == 'single_text' %}
|
||||||
{{ block('form_widget_single_control') }}
|
{{ block('form_widget_simple') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<div {{ block('widget_container_attributes') }}>
|
<div {{ block('widget_container_attributes') }}>
|
||||||
{{ date_pattern|replace({
|
{{ date_pattern|replace({
|
||||||
@ -143,7 +143,7 @@
|
|||||||
{% block time_widget %}
|
{% block time_widget %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% if widget == 'single_text' %}
|
{% if widget == 'single_text' %}
|
||||||
{{ block('form_widget_single_control') }}
|
{{ block('form_widget_simple') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<div {{ block('widget_container_attributes') }}>
|
<div {{ block('widget_container_attributes') }}>
|
||||||
{{ form_widget(form.hour, { 'attr': { 'size': '1' } }) }}:{{ form_widget(form.minute, { 'attr': { 'size': '1' } }) }}{% if with_seconds %}:{{ form_widget(form.second, { 'attr': { 'size': '1' } }) }}{% endif %}
|
{{ form_widget(form.hour, { 'attr': { 'size': '1' } }) }}:{{ form_widget(form.minute, { 'attr': { 'size': '1' } }) }}{% if with_seconds %}:{{ form_widget(form.second, { 'attr': { 'size': '1' } }) }}{% endif %}
|
||||||
@ -156,62 +156,62 @@
|
|||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{# type="number" doesn't work with floats #}
|
{# type="number" doesn't work with floats #}
|
||||||
{% set type = type|default('text') %}
|
{% set type = type|default('text') %}
|
||||||
{{ block('form_widget_single_control') }}
|
{{ block('form_widget_simple') }}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock number_widget %}
|
{% endblock number_widget %}
|
||||||
|
|
||||||
{% block integer_widget %}
|
{% block integer_widget %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% set type = type|default('number') %}
|
{% set type = type|default('number') %}
|
||||||
{{ block('form_widget_single_control') }}
|
{{ block('form_widget_simple') }}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock integer_widget %}
|
{% endblock integer_widget %}
|
||||||
|
|
||||||
{% block money_widget %}
|
{% block money_widget %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{{ money_pattern|replace({ '{{ widget }}': block('form_widget_single_control') })|raw }}
|
{{ money_pattern|replace({ '{{ widget }}': block('form_widget_simple') })|raw }}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock money_widget %}
|
{% endblock money_widget %}
|
||||||
|
|
||||||
{% block url_widget %}
|
{% block url_widget %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% set type = type|default('url') %}
|
{% set type = type|default('url') %}
|
||||||
{{ block('form_widget_single_control') }}
|
{{ block('form_widget_simple') }}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock url_widget %}
|
{% endblock url_widget %}
|
||||||
|
|
||||||
{% block search_widget %}
|
{% block search_widget %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% set type = type|default('search') %}
|
{% set type = type|default('search') %}
|
||||||
{{ block('form_widget_single_control') }}
|
{{ block('form_widget_simple') }}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock search_widget %}
|
{% endblock search_widget %}
|
||||||
|
|
||||||
{% block percent_widget %}
|
{% block percent_widget %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% set type = type|default('text') %}
|
{% set type = type|default('text') %}
|
||||||
{{ block('form_widget_single_control') }} %
|
{{ block('form_widget_simple') }} %
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock percent_widget %}
|
{% endblock percent_widget %}
|
||||||
|
|
||||||
{% block password_widget %}
|
{% block password_widget %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% set type = type|default('password') %}
|
{% set type = type|default('password') %}
|
||||||
{{ block('form_widget_single_control') }}
|
{{ block('form_widget_simple') }}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock password_widget %}
|
{% endblock password_widget %}
|
||||||
|
|
||||||
{% block hidden_widget %}
|
{% block hidden_widget %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% set type = type|default('hidden') %}
|
{% set type = type|default('hidden') %}
|
||||||
{{ block('form_widget_single_control') }}
|
{{ block('form_widget_simple') }}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock hidden_widget %}
|
{% endblock hidden_widget %}
|
||||||
|
|
||||||
{% block email_widget %}
|
{% block email_widget %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% set type = type|default('email') %}
|
{% set type = type|default('email') %}
|
||||||
{{ block('form_widget_single_control') }}
|
{{ block('form_widget_simple') }}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock email_widget %}
|
{% endblock email_widget %}
|
||||||
|
|
||||||
@ -219,7 +219,7 @@
|
|||||||
|
|
||||||
{% block form_label %}
|
{% block form_label %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% if single_control %}
|
{% if not compound %}
|
||||||
{% set label_attr = label_attr|merge({'for': id}) %}
|
{% set label_attr = label_attr|merge({'for': id}) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if required %}
|
{% if required %}
|
||||||
@ -245,7 +245,7 @@
|
|||||||
If the child is a compound form, the errors are rendered inside
|
If the child is a compound form, the errors are rendered inside
|
||||||
the container. See also block form_rows.
|
the container. See also block form_rows.
|
||||||
#}
|
#}
|
||||||
{% if single_control %}
|
{% if not compound %}
|
||||||
{{ form_errors(form) }}
|
{{ form_errors(form) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ form_widget(form) }}
|
{{ form_widget(form) }}
|
||||||
@ -320,7 +320,7 @@
|
|||||||
|
|
||||||
{% block generic_label %}{{ block('form_label') }}{% endblock %}
|
{% block generic_label %}{{ block('form_label') }}{% endblock %}
|
||||||
{% block widget_choice_options %}{{ block('choice_widget_options') }}{% endblock %}
|
{% block widget_choice_options %}{{ block('choice_widget_options') }}{% endblock %}
|
||||||
{% block field_widget %}{{ block('form_widget_single_control') }}{% endblock %}
|
{% block field_widget %}{{ block('form_widget_simple') }}{% endblock %}
|
||||||
{% block field_label %}{{ block('form_label') }}{% endblock %}
|
{% block field_label %}{{ block('form_label') }}{% endblock %}
|
||||||
{% block field_row %}{{ block('form_row') }}{% endblock %}
|
{% block field_row %}{{ block('form_row') }}{% endblock %}
|
||||||
{% block field_enctype %}{{ block('form_enctype') }}{% endblock %}
|
{% block field_enctype %}{{ block('form_enctype') }}{% endblock %}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
{{ form_label(form, label|default(null)) }}
|
{{ form_label(form, label|default(null)) }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if single_control %}
|
{% if not compound %}
|
||||||
{{ form_errors(form) }}
|
{{ form_errors(form) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ form_widget(form) }}
|
{{ form_widget(form) }}
|
||||||
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
{% block form_errors %}
|
{% block form_errors %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% if single_control %}
|
{% if not compound %}
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if errors|length > 0 %}
|
{% if errors|length > 0 %}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{% block form_widget_single_control %}
|
{% block form_widget_simple %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% set type = type|default('text') %}
|
{% set type = type|default('text') %}
|
||||||
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
|
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock form_widget_single_control %}
|
{% endblock form_widget_simple %}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{% extends 'form_div_layout.html.twig' %}
|
{% extends 'form_div_layout.html.twig' %}
|
||||||
|
|
||||||
{% block form_widget_single_control %}
|
{% block form_widget_simple %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% set type = type|default('text') %}
|
{% set type = type|default('text') %}
|
||||||
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
|
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock form_widget_single_control %}
|
{% endblock form_widget_simple %}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{% use 'form_div_layout.html.twig' %}
|
{% use 'form_div_layout.html.twig' %}
|
||||||
|
|
||||||
{% block form_widget_single_control %}
|
{% block form_widget_simple %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% set type = type|default('text') %}
|
{% set type = type|default('text') %}
|
||||||
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
|
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock form_widget_single_control %}
|
{% endblock form_widget_simple %}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php if ($widget == 'single_text'): ?>
|
<?php if ($widget == 'single_text'): ?>
|
||||||
<?php echo $view['form']->renderBlock('form_widget_single_control'); ?>
|
<?php echo $view['form']->renderBlock('form_widget_simple'); ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<div <?php echo $view['form']->renderBlock('widget_container_attributes') ?>>
|
<div <?php echo $view['form']->renderBlock('widget_container_attributes') ?>>
|
||||||
<?php echo str_replace(array('{{ year }}', '{{ month }}', '{{ day }}'), array(
|
<?php echo str_replace(array('{{ year }}', '{{ month }}', '{{ day }}'), array(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php if ($widget == 'single_text'): ?>
|
<?php if ($widget == 'single_text'): ?>
|
||||||
<?php echo $view['form']->renderBlock('form_widget_single_control'); ?>
|
<?php echo $view['form']->renderBlock('form_widget_simple'); ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<div <?php echo $view['form']->renderBlock('widget_container_attributes') ?>>
|
<div <?php echo $view['form']->renderBlock('widget_container_attributes') ?>>
|
||||||
<?php echo $view['form']->widget($form['date']).' '.$view['form']->widget($form['time']) ?>
|
<?php echo $view['form']->widget($form['date']).' '.$view['form']->widget($form['time']) ?>
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->renderBlock('form_widget_single_control', array('type' => isset($type) ? $type : 'email')) ?>
|
<?php echo $view['form']->renderBlock('form_widget_simple', array('type' => isset($type) ? $type : 'email')) ?>
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->renderBlock('form_widget_single_control') ?>
|
<?php echo $view['form']->renderBlock('form_widget_simple') ?>
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<?php if ($required) { $label_attr['class'] = trim((isset($label_attr['class']) ? $label_attr['class'] : '').' required'); } ?>
|
<?php if ($required) { $label_attr['class'] = trim((isset($label_attr['class']) ? $label_attr['class'] : '').' required'); } ?>
|
||||||
<?php if ($single_control) { $label_attr['for'] = $id; } ?>
|
<?php if (!$compound) { $label_attr['for'] = $id; } ?>
|
||||||
<label <?php foreach ($label_attr as $k => $v) { printf('%s="%s" ', $view->escape($k), $view->escape($v)); } ?>><?php echo $view->escape($view['translator']->trans($label, array(), $translation_domain)) ?></label>
|
<label <?php foreach ($label_attr as $k => $v) { printf('%s="%s" ', $view->escape($k), $view->escape($v)); } ?>><?php echo $view->escape($view['translator']->trans($label, array(), $translation_domain)) ?></label>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<div>
|
<div>
|
||||||
<?php echo $view['form']->label($form, isset($label) ? $label : null) ?>
|
<?php echo $view['form']->label($form, isset($label) ? $label : null) ?>
|
||||||
<?php if ($single_control): ?>
|
<?php if (!$compound): ?>
|
||||||
<?php echo $view['form']->errors($form) ?>
|
<?php echo $view['form']->errors($form) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php echo $view['form']->widget($form) ?>
|
<?php echo $view['form']->widget($form) ?>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php if ($single_control): ?>
|
<?php if ($compound): ?>
|
||||||
<?php echo $view['form']->renderBlock('form_widget_single_control')?>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php echo $view['form']->renderBlock('form_widget_compound')?>
|
<?php echo $view['form']->renderBlock('form_widget_compound')?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php echo $view['form']->renderBlock('form_widget_simple')?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->renderBlock('form_widget_single_control', array('type' => isset($type) ? $type : "hidden")) ?>
|
<?php echo $view['form']->renderBlock('form_widget_simple', array('type' => isset($type) ? $type : "hidden")) ?>
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->renderBlock('form_widget_single_control', array('type' => isset($type) ? $type : "number")) ?>
|
<?php echo $view['form']->renderBlock('form_widget_simple', array('type' => isset($type) ? $type : "number")) ?>
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo str_replace('{{ widget }}', $view['form']->renderBlock('form_widget_single_control'), $money_pattern) ?>
|
<?php echo str_replace('{{ widget }}', $view['form']->renderBlock('form_widget_simple'), $money_pattern) ?>
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->renderBlock('form_widget_single_control', array('type' => isset($type) ? $type : "text")) ?>
|
<?php echo $view['form']->renderBlock('form_widget_simple', array('type' => isset($type) ? $type : "text")) ?>
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->renderBlock('form_widget_single_control', array('type' => isset($type) ? $type : "password")) ?>
|
<?php echo $view['form']->renderBlock('form_widget_simple', array('type' => isset($type) ? $type : "password")) ?>
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->renderBlock('form_widget_single_control', array('type' => isset($type) ? $type : "text")) ?> %
|
<?php echo $view['form']->renderBlock('form_widget_simple', array('type' => isset($type) ? $type : "text")) ?> %
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->renderBlock('form_widget_single_control', array('type' => isset($type) ? $type : "search")) ?>
|
<?php echo $view['form']->renderBlock('form_widget_simple', array('type' => isset($type) ? $type : "search")) ?>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php if ($widget == 'single_text'): ?>
|
<?php if ($widget == 'single_text'): ?>
|
||||||
<?php echo $view['form']->renderBlock('form_widget_single_control'); ?>
|
<?php echo $view['form']->renderBlock('form_widget_simple'); ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<div <?php echo $view['form']->renderBlock('widget_container_attributes') ?>>
|
<div <?php echo $view['form']->renderBlock('widget_container_attributes') ?>>
|
||||||
<?php
|
<?php
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->renderBlock('form_widget_single_control', array('type' => isset($type) ? $type : "url")) ?>
|
<?php echo $view['form']->renderBlock('form_widget_simple', array('type' => isset($type) ? $type : "url")) ?>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php if ($single_control): ?>
|
<?php if (!$compound): ?>
|
||||||
<?php if ($errors): ?>
|
<?php if ($errors): ?>
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach ($errors as $error): ?>
|
<?php foreach ($errors as $error): ?>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<?php echo $view['form']->label($form, isset($label) ? $label : null) ?>
|
<?php echo $view['form']->label($form, isset($label) ? $label : null) ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($single_control): ?>
|
<?php if (!$compound): ?>
|
||||||
<?php echo $view['form']->errors($form) ?>
|
<?php echo $view['form']->errors($form) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php echo $view['form']->widget($form) ?>
|
<?php echo $view['form']->widget($form) ?>
|
||||||
|
@ -55,9 +55,10 @@ CHANGELOG
|
|||||||
by event subscribers
|
by event subscribers
|
||||||
* simplified CSRF protection and removed the csrf type
|
* simplified CSRF protection and removed the csrf type
|
||||||
* deprecated FieldType and merged it into FormType
|
* deprecated FieldType and merged it into FormType
|
||||||
|
* added new option "compound" that lets you switch between field and form behavior
|
||||||
* [BC BREAK] renamed theme blocks
|
* [BC BREAK] renamed theme blocks
|
||||||
* "field_*" to "form_*"
|
* "field_*" to "form_*"
|
||||||
* "field_widget" to "form_widget_single_control"
|
* "field_widget" to "form_widget_simple"
|
||||||
* "widget_choice_options" to "choice_widget_options"
|
* "widget_choice_options" to "choice_widget_options"
|
||||||
* "generic_label" to "form_label"
|
* "generic_label" to "form_label"
|
||||||
* added theme blocks "form_widget_compound", "choice_widget_expanded" and
|
* added theme blocks "form_widget_compound", "choice_widget_expanded" and
|
||||||
|
@ -51,9 +51,9 @@ class CheckboxType extends AbstractType
|
|||||||
};
|
};
|
||||||
|
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
'value' => '1',
|
'value' => '1',
|
||||||
'empty_data' => $emptyData,
|
'empty_data' => $emptyData,
|
||||||
'single_control' => true,
|
'compound' => false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,8 +150,8 @@ class ChoiceType extends AbstractType
|
|||||||
return $emptyValue;
|
return $emptyValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
$singleControl = function (Options $options) {
|
$compound = function (Options $options) {
|
||||||
return !$options['expanded'];
|
return $options['expanded'];
|
||||||
};
|
};
|
||||||
|
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
@ -163,7 +163,7 @@ class ChoiceType extends AbstractType
|
|||||||
'empty_data' => $emptyData,
|
'empty_data' => $emptyData,
|
||||||
'empty_value' => $emptyValue,
|
'empty_value' => $emptyValue,
|
||||||
'error_bubbling' => false,
|
'error_bubbling' => false,
|
||||||
'single_control' => $singleControl,
|
'compound' => $compound,
|
||||||
));
|
));
|
||||||
|
|
||||||
$resolver->setFilters(array(
|
$resolver->setFilters(array(
|
||||||
|
@ -130,8 +130,8 @@ class DateTimeType extends AbstractType
|
|||||||
*/
|
*/
|
||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||||
{
|
{
|
||||||
$singleControl = function (Options $options) {
|
$compound = function (Options $options) {
|
||||||
return $options['widget'] === 'single_text';
|
return $options['widget'] !== 'single_text';
|
||||||
};
|
};
|
||||||
|
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
@ -162,7 +162,7 @@ class DateTimeType extends AbstractType
|
|||||||
// representation is not \DateTime, but an array, we need to unset
|
// representation is not \DateTime, but an array, we need to unset
|
||||||
// this option.
|
// this option.
|
||||||
'data_class' => null,
|
'data_class' => null,
|
||||||
'single_control' => $singleControl,
|
'compound' => $compound,
|
||||||
));
|
));
|
||||||
|
|
||||||
$resolver->setAllowedValues(array(
|
$resolver->setAllowedValues(array(
|
||||||
|
@ -165,8 +165,8 @@ class DateType extends AbstractType
|
|||||||
*/
|
*/
|
||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||||
{
|
{
|
||||||
$singleControl = function (Options $options) {
|
$compound = function (Options $options) {
|
||||||
return $options['widget'] === 'single_text';
|
return $options['widget'] !== 'single_text';
|
||||||
};
|
};
|
||||||
|
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
@ -188,7 +188,7 @@ class DateType extends AbstractType
|
|||||||
// representation is not \DateTime, but an array, we need to unset
|
// representation is not \DateTime, but an array, we need to unset
|
||||||
// this option.
|
// this option.
|
||||||
'data_class' => null,
|
'data_class' => null,
|
||||||
'single_control' => $singleControl,
|
'compound' => $compound,
|
||||||
));
|
));
|
||||||
|
|
||||||
$resolver->setAllowedValues(array(
|
$resolver->setAllowedValues(array(
|
||||||
|
@ -45,7 +45,7 @@ class FileType extends AbstractType
|
|||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||||
{
|
{
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
'single_control' => true,
|
'compound' => false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ class FormType extends AbstractType
|
|||||||
'multipart' => false,
|
'multipart' => false,
|
||||||
'attr' => $options['attr'],
|
'attr' => $options['attr'],
|
||||||
'label_attr' => $options['label_attr'],
|
'label_attr' => $options['label_attr'],
|
||||||
'single_control' => $options['single_control'],
|
'compound' => $options['compound'],
|
||||||
'types' => $types,
|
'types' => $types,
|
||||||
'translation_domain' => $options['translation_domain'],
|
'translation_domain' => $options['translation_domain'],
|
||||||
));
|
));
|
||||||
@ -170,7 +170,7 @@ class FormType extends AbstractType
|
|||||||
// For any form that is not represented by a single HTML control,
|
// For any form that is not represented by a single HTML control,
|
||||||
// errors should bubble up by default
|
// errors should bubble up by default
|
||||||
$errorBubbling = function (Options $options) {
|
$errorBubbling = function (Options $options) {
|
||||||
return !$options['single_control'];
|
return $options['compound'];
|
||||||
};
|
};
|
||||||
|
|
||||||
// BC clause: former property_path=false now equals mapped=false
|
// BC clause: former property_path=false now equals mapped=false
|
||||||
@ -196,7 +196,7 @@ class FormType extends AbstractType
|
|||||||
'attr' => array(),
|
'attr' => array(),
|
||||||
'label_attr' => array(),
|
'label_attr' => array(),
|
||||||
'virtual' => false,
|
'virtual' => false,
|
||||||
'single_control' => false,
|
'compound' => true,
|
||||||
'translation_domain' => 'messages',
|
'translation_domain' => 'messages',
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class HiddenType extends AbstractType
|
|||||||
'required' => false,
|
'required' => false,
|
||||||
// Pass errors to the parent
|
// Pass errors to the parent
|
||||||
'error_bubbling' => true,
|
'error_bubbling' => true,
|
||||||
'single_control' => true,
|
'compound' => false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,11 +38,11 @@ class IntegerType extends AbstractType
|
|||||||
{
|
{
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
// default precision is locale specific (usually around 3)
|
// default precision is locale specific (usually around 3)
|
||||||
'precision' => null,
|
'precision' => null,
|
||||||
'grouping' => false,
|
'grouping' => false,
|
||||||
// Integer cast rounds towards 0, so do the same when displaying fractions
|
// Integer cast rounds towards 0, so do the same when displaying fractions
|
||||||
'rounding_mode' => \NumberFormatter::ROUND_DOWN,
|
'rounding_mode' => \NumberFormatter::ROUND_DOWN,
|
||||||
'single_control' => true,
|
'compound' => false,
|
||||||
));
|
));
|
||||||
|
|
||||||
$resolver->setAllowedValues(array(
|
$resolver->setAllowedValues(array(
|
||||||
|
@ -51,11 +51,11 @@ class MoneyType extends AbstractType
|
|||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||||
{
|
{
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
'precision' => 2,
|
'precision' => 2,
|
||||||
'grouping' => false,
|
'grouping' => false,
|
||||||
'divisor' => 1,
|
'divisor' => 1,
|
||||||
'currency' => 'EUR',
|
'currency' => 'EUR',
|
||||||
'single_control' => true,
|
'compound' => false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,10 +37,10 @@ class NumberType extends AbstractType
|
|||||||
{
|
{
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
// default precision is locale specific (usually around 3)
|
// default precision is locale specific (usually around 3)
|
||||||
'precision' => null,
|
'precision' => null,
|
||||||
'grouping' => false,
|
'grouping' => false,
|
||||||
'rounding_mode' => \NumberFormatter::ROUND_HALFUP,
|
'rounding_mode' => \NumberFormatter::ROUND_HALFUP,
|
||||||
'single_control' => true,
|
'compound' => false,
|
||||||
));
|
));
|
||||||
|
|
||||||
$resolver->setAllowedValues(array(
|
$resolver->setAllowedValues(array(
|
||||||
|
@ -32,9 +32,9 @@ class PercentType extends AbstractType
|
|||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||||
{
|
{
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
'precision' => 0,
|
'precision' => 0,
|
||||||
'type' => 'fractional',
|
'type' => 'fractional',
|
||||||
'single_control' => true,
|
'compound' => false,
|
||||||
));
|
));
|
||||||
|
|
||||||
$resolver->setAllowedValues(array(
|
$resolver->setAllowedValues(array(
|
||||||
|
@ -34,7 +34,7 @@ class TextType extends AbstractType
|
|||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||||
{
|
{
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
'single_control' => true,
|
'compound' => false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,8 +130,8 @@ class TimeType extends AbstractType
|
|||||||
*/
|
*/
|
||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||||
{
|
{
|
||||||
$singleControl = function (Options $options) {
|
$compound = function (Options $options) {
|
||||||
return $options['widget'] === 'single_text';
|
return $options['widget'] !== 'single_text';
|
||||||
};
|
};
|
||||||
|
|
||||||
$emptyValueFilter = function (Options $options, $emptyValue) {
|
$emptyValueFilter = function (Options $options, $emptyValue) {
|
||||||
@ -168,7 +168,7 @@ class TimeType extends AbstractType
|
|||||||
// representation is not \DateTime, but an array, we need to unset
|
// representation is not \DateTime, but an array, we need to unset
|
||||||
// this option.
|
// this option.
|
||||||
'data_class' => null,
|
'data_class' => null,
|
||||||
'single_control' => $singleControl,
|
'compound' => $compound,
|
||||||
));
|
));
|
||||||
|
|
||||||
$resolver->setFilters(array(
|
$resolver->setFilters(array(
|
||||||
|
@ -63,7 +63,7 @@ class CsrfValidationListener implements EventSubscriberInterface
|
|||||||
$form = $event->getForm();
|
$form = $event->getForm();
|
||||||
$data = $event->getData();
|
$data = $event->getData();
|
||||||
|
|
||||||
if ($form->isRoot() && !$form->getConfig()->getOption('single_control')) {
|
if ($form->isRoot() && $form->getConfig()->getOption('compound')) {
|
||||||
if (!isset($data[$this->fieldName]) || !$this->csrfProvider->isCsrfTokenValid($this->intention, $data[$this->fieldName])) {
|
if (!isset($data[$this->fieldName]) || !$this->csrfProvider->isCsrfTokenValid($this->intention, $data[$this->fieldName])) {
|
||||||
$form->addError(new FormError('The CSRF token is invalid. Please try to resubmit the form'));
|
$form->addError(new FormError('The CSRF token is invalid. Please try to resubmit the form'));
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ class FormTypeCsrfExtension extends AbstractTypeExtension
|
|||||||
*/
|
*/
|
||||||
public function finishView(FormViewInterface $view, FormInterface $form, array $options)
|
public function finishView(FormViewInterface $view, FormInterface $form, array $options)
|
||||||
{
|
{
|
||||||
if ($options['csrf_protection'] && !$view->hasParent() && !$options['single_control']) {
|
if ($options['csrf_protection'] && !$view->hasParent() && $options['compound']) {
|
||||||
$factory = $form->getConfig()->getAttribute('csrf_factory');
|
$factory = $form->getConfig()->getAttribute('csrf_factory');
|
||||||
$data = $options['csrf_provider']->generateCsrfToken($options['intention']);
|
$data = $options['csrf_provider']->generateCsrfToken($options['intention']);
|
||||||
|
|
||||||
|
@ -529,19 +529,19 @@ class FormTypeTest extends TypeTestCase
|
|||||||
$this->assertFalse($view->isRendered());
|
$this->assertFalse($view->isRendered());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testErrorBubblingIfNoSingleControl()
|
public function testErrorBubblingIfCompound()
|
||||||
{
|
{
|
||||||
$form = $this->factory->create('form', null, array(
|
$form = $this->factory->create('form', null, array(
|
||||||
'single_control' => false,
|
'compound' => true,
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertTrue($form->getErrorBubbling());
|
$this->assertTrue($form->getErrorBubbling());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNoErrorBubblingIfSingleControl()
|
public function testNoErrorBubblingIfNotCompound()
|
||||||
{
|
{
|
||||||
$form = $this->factory->create('form', null, array(
|
$form = $this->factory->create('form', null, array(
|
||||||
'single_control' => true,
|
'compound' => false,
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertFalse($form->getErrorBubbling());
|
$this->assertFalse($form->getErrorBubbling());
|
||||||
@ -550,7 +550,7 @@ class FormTypeTest extends TypeTestCase
|
|||||||
public function testOverrideErrorBubbling()
|
public function testOverrideErrorBubbling()
|
||||||
{
|
{
|
||||||
$form = $this->factory->create('form', null, array(
|
$form = $this->factory->create('form', null, array(
|
||||||
'single_control' => true,
|
'compound' => false,
|
||||||
'error_bubbling' => true,
|
'error_bubbling' => true,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -56,26 +56,26 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCsrfProtectionByDefaultIfRootAndNotSingleControl()
|
public function testCsrfProtectionByDefaultIfRootAndCompound()
|
||||||
{
|
{
|
||||||
$view = $this->factory
|
$view = $this->factory
|
||||||
->create('form', null, array(
|
->create('form', null, array(
|
||||||
'csrf_field_name' => 'csrf',
|
'csrf_field_name' => 'csrf',
|
||||||
'single_control' => false,
|
'compound' => true,
|
||||||
))
|
))
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
$this->assertTrue($view->has('csrf'));
|
$this->assertTrue($view->has('csrf'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNoCsrfProtectionByDefaultIfNotSingleControlButNotRoot()
|
public function testNoCsrfProtectionByDefaultIfCompoundButNotRoot()
|
||||||
{
|
{
|
||||||
$view = $this->factory
|
$view = $this->factory
|
||||||
->createNamedBuilder('root', 'form')
|
->createNamedBuilder('root', 'form')
|
||||||
->add($this->factory
|
->add($this->factory
|
||||||
->createNamedBuilder('form', 'form', null, array(
|
->createNamedBuilder('form', 'form', null, array(
|
||||||
'csrf_field_name' => 'csrf',
|
'csrf_field_name' => 'csrf',
|
||||||
'single_control' => false,
|
'compound' => true,
|
||||||
))
|
))
|
||||||
)
|
)
|
||||||
->getForm()
|
->getForm()
|
||||||
@ -85,12 +85,12 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
$this->assertFalse($view->has('csrf'));
|
$this->assertFalse($view->has('csrf'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNoCsrfProtectionByDefaultIfRootButSingleControl()
|
public function testNoCsrfProtectionByDefaultIfRootButNotCompound()
|
||||||
{
|
{
|
||||||
$view = $this->factory
|
$view = $this->factory
|
||||||
->create('form', null, array(
|
->create('form', null, array(
|
||||||
'csrf_field_name' => 'csrf',
|
'csrf_field_name' => 'csrf',
|
||||||
'single_control' => true,
|
'compound' => false,
|
||||||
))
|
))
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
->create('form', null, array(
|
->create('form', null, array(
|
||||||
'csrf_field_name' => 'csrf',
|
'csrf_field_name' => 'csrf',
|
||||||
'csrf_protection' => false,
|
'csrf_protection' => false,
|
||||||
'single_control' => false,
|
'compound' => true,
|
||||||
))
|
))
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
'csrf_field_name' => 'csrf',
|
'csrf_field_name' => 'csrf',
|
||||||
'csrf_provider' => $this->csrfProvider,
|
'csrf_provider' => $this->csrfProvider,
|
||||||
'intention' => '%INTENTION%',
|
'intention' => '%INTENTION%',
|
||||||
'single_control' => false,
|
'compound' => true,
|
||||||
))
|
))
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
/**
|
/**
|
||||||
* @dataProvider provideBoolean
|
* @dataProvider provideBoolean
|
||||||
*/
|
*/
|
||||||
public function testValidateTokenOnBindIfRootAndNotSingleControl($valid)
|
public function testValidateTokenOnBindIfRootAndCompound($valid)
|
||||||
{
|
{
|
||||||
$this->csrfProvider->expects($this->once())
|
$this->csrfProvider->expects($this->once())
|
||||||
->method('isCsrfTokenValid')
|
->method('isCsrfTokenValid')
|
||||||
@ -152,7 +152,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
'csrf_field_name' => 'csrf',
|
'csrf_field_name' => 'csrf',
|
||||||
'csrf_provider' => $this->csrfProvider,
|
'csrf_provider' => $this->csrfProvider,
|
||||||
'intention' => '%INTENTION%',
|
'intention' => '%INTENTION%',
|
||||||
'single_control' => false,
|
'compound' => true,
|
||||||
));
|
));
|
||||||
|
|
||||||
$form->bind(array(
|
$form->bind(array(
|
||||||
@ -167,7 +167,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
$this->assertSame($valid, $form->isValid());
|
$this->assertSame($valid, $form->isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFailIfRootAndNotSingleControlAndTokenMissing()
|
public function testFailIfRootAndCompoundAndTokenMissing()
|
||||||
{
|
{
|
||||||
$this->csrfProvider->expects($this->never())
|
$this->csrfProvider->expects($this->never())
|
||||||
->method('isCsrfTokenValid');
|
->method('isCsrfTokenValid');
|
||||||
@ -177,7 +177,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
'csrf_field_name' => 'csrf',
|
'csrf_field_name' => 'csrf',
|
||||||
'csrf_provider' => $this->csrfProvider,
|
'csrf_provider' => $this->csrfProvider,
|
||||||
'intention' => '%INTENTION%',
|
'intention' => '%INTENTION%',
|
||||||
'single_control' => false,
|
'compound' => true,
|
||||||
));
|
));
|
||||||
|
|
||||||
$form->bind(array(
|
$form->bind(array(
|
||||||
@ -192,7 +192,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
$this->assertFalse($form->isValid());
|
$this->assertFalse($form->isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDontValidateTokenIfNotSingleControlButNoRoot()
|
public function testDontValidateTokenIfCompoundButNoRoot()
|
||||||
{
|
{
|
||||||
$this->csrfProvider->expects($this->never())
|
$this->csrfProvider->expects($this->never())
|
||||||
->method('isCsrfTokenValid');
|
->method('isCsrfTokenValid');
|
||||||
@ -204,7 +204,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
'csrf_field_name' => 'csrf',
|
'csrf_field_name' => 'csrf',
|
||||||
'csrf_provider' => $this->csrfProvider,
|
'csrf_provider' => $this->csrfProvider,
|
||||||
'intention' => '%INTENTION%',
|
'intention' => '%INTENTION%',
|
||||||
'single_control' => false,
|
'compound' => true,
|
||||||
))
|
))
|
||||||
)
|
)
|
||||||
->getForm()
|
->getForm()
|
||||||
@ -216,7 +216,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDontValidateTokenIfRootButSingleControl()
|
public function testDontValidateTokenIfRootButNotCompound()
|
||||||
{
|
{
|
||||||
$this->csrfProvider->expects($this->never())
|
$this->csrfProvider->expects($this->never())
|
||||||
->method('isCsrfTokenValid');
|
->method('isCsrfTokenValid');
|
||||||
@ -226,7 +226,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||||||
'csrf_field_name' => 'csrf',
|
'csrf_field_name' => 'csrf',
|
||||||
'csrf_provider' => $this->csrfProvider,
|
'csrf_provider' => $this->csrfProvider,
|
||||||
'intention' => '%INTENTION%',
|
'intention' => '%INTENTION%',
|
||||||
'single_control' => true,
|
'compound' => false,
|
||||||
));
|
));
|
||||||
|
|
||||||
$form->bind(array(
|
$form->bind(array(
|
||||||
|
Reference in New Issue
Block a user