Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch '2.1'

  • Loading branch information...
commit 2537f6f608ec243fad5dbd2ed279f9172c2eb99e 2 parents 940d14c + 4ad71b4
@bamarni bamarni authored
View
5 Form/JQuery/Type/Select2Type.php
@@ -41,6 +41,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
{
if ('hidden' === $this->widget && !empty($options['configs']['multiple'])) {
$builder->addViewTransformer(new ArrayToStringTransformer());
+ } elseif ('hidden' === $this->widget && empty($options['configs']['multiple']) && null !== $options['transformer']) {
+ $builder->addModelTransformer($options['transformer']);
}
}
@@ -73,7 +75,8 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
);
$resolver
->setDefaults(array(
- 'configs' => $defaults,
+ 'configs' => $defaults,
+ 'transformer' => null,
))
->setNormalizers(array(
'configs' => function (Options $options, $configs) use ($defaults) {
View
1  Resources/views/Form/div_layout.html.twig
@@ -31,6 +31,7 @@
{% set attr = {"size": 10}|merge(attr) %}
{% set id = "datepicker_" ~ id %}
+ {% set value = '' %}
{% set full_name = "datepicker_" ~ full_name %}
{{ block("hidden_widget") }}
</div>
View
4 Resources/views/Form/jquery_layout.html.twig
@@ -76,7 +76,7 @@
<script type="text/javascript">
jQuery(document).ready(function($) {
- $field = $('#{{ id }}');
+ $field = $('#{% if widget != "single_text" %}datepicker_{% endif %}{{ id }}');
{% block genemu_jquerydate_javascript_prototype %}
@@ -96,8 +96,6 @@
}, $.datepicker.regional['{{ culture }}'] ,{{ configs|json_encode|raw }});
{% if widget != "single_text" %}
- {% set id = "datepicker_" ~ id %}
-
var $year = $('#{{ form.year.vars.id }}');
var $month = $('#{{ form.month.vars.id }}');
var $day = $('#{{ form.day.vars.id }}');
View
20 Twig/Extension/FormExtension.php
@@ -11,17 +11,30 @@
namespace Genemu\Bundle\FormBundle\Twig\Extension;
-use Symfony\Bridge\Twig\Extension\FormExtension as BaseFormExtension;
use Symfony\Component\Form\FormView;
+use Symfony\Bridge\Twig\Form\TwigRendererInterface;
/**
* FormExtension extends Twig with form capabilities.
*
* @author Olivier Chauvel <olivier@generation-multiple.com>
*/
-class FormExtension extends BaseFormExtension
+class FormExtension extends \Twig_Extension
{
/**
+ * This property is public so that it can be accessed directly from compiled
+ * templates without having to call a getter, which slightly decreases performance.
+ *
+ * @var \Symfony\Component\Form\FormRendererInterface
+ */
+ public $renderer;
+
+ public function __construct(TwigRendererInterface $renderer)
+ {
+ $this->renderer = $renderer;
+ }
+
+ /**
* {@inheritdoc}
*/
public function getFunctions()
@@ -35,7 +48,8 @@ public function getFunctions()
/**
* Render Function Form Javascript
*
- * @param FromView $view
+ * @param FormView $view
+ * @param bool $prototype
*
* @return string
*/
Please sign in to comment.
Something went wrong with that request. Please try again.