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 = []; $options = [];
switch ($type) { switch ($type) {
case ChoiceType::class: case ChoiceType::class:
if (is_callable($config['choices'])) {
$options['choices'] = $config['choices']();
} else {
$options['choices'] = $config['choices']; $options['choices'] = $config['choices'];
}
break; break;
case CheckboxType::class: case CheckboxType::class:
$options['required'] = false; $options['required'] = false;