浏览代码

Allows options to be a callable

Thomas Rabaix 11 年之前
父节点
当前提交
1db83d7d15
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      Form/Type/ImmutableArrayType.php

+ 5 - 0
Form/Type/ImmutableArrayType.php

@@ -28,6 +28,11 @@ class ImmutableArrayType extends AbstractType
                 $builder->add($infos);
             } else {
                 list($name, $type, $options) = $infos;
+
+                if (is_callable($options)) {
+                    $options = $options($builder, $options);
+                }
+
                 $builder->add($name, $type, $options);
             }
         }