From 8bcd3af68aee97ec86ad7953e187b214a849101b Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 19 Jun 2019 11:45:22 +0200 Subject: [PATCH] Allow for callable choice argument --- Controller/BaseController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Controller/BaseController.php b/Controller/BaseController.php index b6244da..cb8dce1 100644 --- a/Controller/BaseController.php +++ b/Controller/BaseController.php @@ -74,7 +74,11 @@ abstract class BaseController extends AbstractController $options = []; switch ($type) { case ChoiceType::class: - $options['choices'] = $config['choices']; + if (is_callable($config['choices'])) { + $options['choices'] = $config['choices'](); + } else { + $options['choices'] = $config['choices']; + } break; case CheckboxType::class: $options['required'] = false;