From af8cf57e7a0ca952e744254e36a98062e2137d46 Mon Sep 17 00:00:00 2001 From: Jarek Jakubowski Date: Tue, 19 Feb 2019 21:13:26 +0100 Subject: [PATCH 1/2] Update choice_label docs to match given examples --- reference/forms/types/options/choice_label.rst.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reference/forms/types/options/choice_label.rst.inc b/reference/forms/types/options/choice_label.rst.inc index 8935757b7e0..bf57acc0427 100644 --- a/reference/forms/types/options/choice_label.rst.inc +++ b/reference/forms/types/options/choice_label.rst.inc @@ -17,7 +17,7 @@ more control:: 'maybe' => null, ], 'choice_label' => function ($choiceValue, $key, $value) { - if ($value == $choiceValue) { + if (true === $choiceValue) { return 'Definitely!'; } @@ -28,8 +28,8 @@ more control:: }, ]); -This method is called for *each* choice, passing you the choice ``$value`` and the -``$key`` from the choices array (``$index`` is related to `choice_value`_). This +This method is called for *each* choice, passing you the ``$choiceValue`` and the +``$key`` from the choices array (``$value`` is related to `choice_value`_). This will give you: .. image:: /_images/reference/form/choice-example2.png From ab88da0194a3fbec81c4decc39ef1c19fd4495c2 Mon Sep 17 00:00:00 2001 From: Jarek Jakubowski Date: Wed, 20 Feb 2019 11:56:37 +0100 Subject: [PATCH 2/2] Make choice_label docs even more clear --- reference/forms/types/options/choice_label.rst.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/reference/forms/types/options/choice_label.rst.inc b/reference/forms/types/options/choice_label.rst.inc index bf57acc0427..55bc59d5c34 100644 --- a/reference/forms/types/options/choice_label.rst.inc +++ b/reference/forms/types/options/choice_label.rst.inc @@ -16,8 +16,8 @@ more control:: 'no' => false, 'maybe' => null, ], - 'choice_label' => function ($choiceValue, $key, $value) { - if (true === $choiceValue) { + 'choice_label' => function ($value, $key, $choiceValue) { + if (true === $value) { return 'Definitely!'; } @@ -28,9 +28,9 @@ more control:: }, ]); -This method is called for *each* choice, passing you the ``$choiceValue`` and the -``$key`` from the choices array (``$value`` is related to `choice_value`_). This -will give you: +This method is called for *each* choice, passing you the ``$value`` and +``$key`` from the choices array (additional ``$choiceValue`` is related to `choice_value`_). +This will give you: .. image:: /_images/reference/form/choice-example2.png :align: center