|
1 | | -.. index:: |
2 | | - single: Form; Custom choice type |
3 | | - |
4 | 1 | How to Create a Custom Choice Field Type |
5 | | -========================================= |
| 2 | +======================================== |
6 | 3 |
|
7 | 4 | The :doc:`ChoiceType </reference/forms/types/choice>` is one of the most |
8 | 5 | powerful form types in Symfony. When you need to reuse the same set of choices |
@@ -121,7 +118,7 @@ to ensure a separate cache entry per combination:: |
121 | 118 | } |
122 | 119 |
|
123 | 120 | Creating a Custom Choice Loader |
124 | | --------------------------------- |
| 121 | +------------------------------- |
125 | 122 |
|
126 | 123 | When the loading logic is too complex for a simple callback, implement a |
127 | 124 | dedicated choice loader. The easiest way is to extend |
@@ -164,7 +161,7 @@ methods: |
164 | 161 |
|
165 | 162 | ``doLoadValuesForChoices(array $choices)`` |
166 | 163 | Returns the string values for the given choices. This is an alternative to |
167 | | - the :ref:`choice_value <reference-form-choice-value>` option. |
| 164 | + the ``choice_value`` option. |
168 | 165 |
|
169 | 166 | :: |
170 | 167 |
|
@@ -217,7 +214,7 @@ caching:: |
217 | 214 | } |
218 | 215 |
|
219 | 216 | Using ``choice_lazy`` for Large Datasets |
220 | | ------------------------------------------ |
| 217 | +---------------------------------------- |
221 | 218 |
|
222 | 219 | When dealing with a very large number of choices (e.g. thousands of users), |
223 | 220 | rendering them all in a ``<select>`` element is impractical. Set the |
|
0 commit comments