mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX More context for GridFieldDataColumns callbacks
This emulates the callback signature from GridFieldEditableColumns in the symbiote/silverstripe-gridfieldextensions module, which extends GridFieldDataColumns. In case canEdit() fails, this component passes control back to the parent (rendering a standard column content rather than a formfield). Which can become an issue if you've defined custom 'callback' handlers on setDisplayFields() - GridFieldDataColumns passes in only one arg (`$record`), while GridFieldEditableColumns passes in three (`$record`, `$col` and `$grid`). While you could argue that this is a bug in the other module, I think this additional context is beneficial for the main GridFieldDataColumns use case as well, and it just happens to fix that bug.
This commit is contained in:
parent
d3d81ad96c
commit
1f0a78e57b
@ -159,7 +159,7 @@ class GridFieldDataColumns implements GridField_ColumnProvider
|
||||
// Allow callbacks
|
||||
if (is_array($columnInfo) && isset($columnInfo['callback'])) {
|
||||
$method = $columnInfo['callback'];
|
||||
$value = $method($record);
|
||||
$value = $method($record, $columnName, $gridField);
|
||||
|
||||
// This supports simple FieldName syntax
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user