You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/field_types.md
+46-17Lines changed: 46 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -326,8 +326,34 @@ Callback
326
326
The Callback column aims to offer almost as much flexibility as the Twig column, but without requiring the creation of a template.
327
327
You simply need to specify a callback, which allows you to transform the 'data' variable on the fly.
328
328
329
-
By default it uses the name of the field, but you can specify the path
330
-
alternatively. For example:
329
+
When defining callbacks in YAML, only string representations of callables are supported.
330
+
When configuring grids using PHP (as opposed to service grid configuration), both string and array callables are supported. However, closures cannot be used due to restrictions in Symfony's configuration (values of type "Closure" are not permitted in service configuration files).
331
+
By contrast, when configuring grids with service definitions, you can use both callables and closures.
CallbackField::create('status' fn (array $status): string => "<strong>$status</strong>", false) // the third argument allows to disable htmlspecialchars if set to false
351
-
->setLabel('app.ui.status') // # each filed type can have a label, we suggest using translation keys instead of messages
CallbackField::create('status' fn (array $status): string => "<strong>$status</strong>", false) // the third argument allows to disable htmlspecialchars if set to false
391
-
->setLabel('app.ui.status') // # each filed type can have a label, we suggest using translation keys instead of messages
0 commit comments