Skip to content

Commit 2441fa6

Browse files
committed
update docs
1 parent c1ecf13 commit 2441fa6

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

user_guide_src/source/libraries/validation.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,10 @@ Or you can use the following parameters:
858858
.. literalinclude:: validation/041.php
859859
:lines: 2-
860860

861+
.. note:: Since v4.8.0, the ``{field}``, ``{param}``, and ``{value}`` placeholders are supported in ``$error``
862+
messages and will be replaced with the field's human-readable label (or field name if no label is set),
863+
the rule parameter, and the submitted value respectively.
864+
861865
.. _validation-using-callable-rule:
862866

863867
Using Callable Rule
@@ -881,6 +885,10 @@ Or you can use the following parameters:
881885
.. literalinclude:: validation/047.php
882886
:lines: 2-
883887

888+
.. note:: Since v4.8.0, the ``{field}``, ``{param}``, and ``{value}`` placeholders are supported in ``$error``
889+
messages and will be replaced with the field's human-readable label (or field name if no label is set),
890+
the rule parameter, and the submitted value respectively.
891+
884892
.. _validation-available-rules:
885893

886894
***************

user_guide_src/source/libraries/validation/035.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ public function even($value, ?string &$error = null): bool
66
{
77
if ((int) $value % 2 !== 0) {
88
$error = lang('myerrors.evenError');
9+
// You can also use {field}, {param}, and {value} placeholders:
10+
// $error = 'The value of {field} is not even.';
911

1012
return false;
1113
}

user_guide_src/source/libraries/validation/041.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ static function ($value, $data, &$error, $field) {
88
return true;
99
}
1010

11-
$error = 'The value is not even.';
11+
$error = 'The value of {field} is not even.';
1212

1313
return false;
1414
},

user_guide_src/source/libraries/validation/047.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function _ruleEven($value, $data, &$error, $field): bool
1313
return true;
1414
}
1515

16-
$error = 'The value is not even.';
16+
$error = 'The value of {field} is not even.';
1717

1818
return false;
1919
}

0 commit comments

Comments
 (0)