Allow for callable choice argument

This commit is contained in:
Tim 2019-06-19 11:45:22 +02:00
parent 03b561ab1d
commit 8bcd3af68a

View File

@ -74,7 +74,11 @@ abstract class BaseController extends AbstractController
$options = [];
switch ($type) {
case ChoiceType::class:
if (is_callable($config['choices'])) {
$options['choices'] = $config['choices']();
} else {
$options['choices'] = $config['choices'];
}
break;
case CheckboxType::class:
$options['required'] = false;