File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -184,6 +184,19 @@ The ``choice_loader`` can be used to only partially load the choices in cases wh
184
184
a fully-loaded list is not necessary. This is only needed in advanced cases and
185
185
would replace the ``choices `` option.
186
186
187
+ You can use an instance of :class: `Symfony\\ Component\\ Form\\ ChoiceList\\ Loader\\ CallbackChoiceLoader `
188
+ if you want to take advantage of lazy loading::
189
+
190
+ use Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader;
191
+ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
192
+ // ...
193
+
194
+ $builder->add('constants', ChoiceType::class, array(
195
+ 'choice_loader' => new CallbackChoiceLoader(function() {
196
+ return StaticClass::getConstants();
197
+ },
198
+ ));
199
+
187
200
.. include :: /reference/forms/types/options/choice_name.rst.inc
188
201
189
202
.. include :: /reference/forms/types/options/choice_translation_domain.rst.inc
You can’t perform that action at this time.
0 commit comments