Skip to content

Instantly share code, notes, and snippets.

@kinglozzer
Created May 22, 2015 10:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kinglozzer/4e940cbb29d08e7a715b to your computer and use it in GitHub Desktop.
Save kinglozzer/4e940cbb29d08e7a715b to your computer and use it in GitHub Desktop.
<?php
$dataColumns = $grid->getConfig()->getComponentByType('GridFieldDataColumns');
$dataColumns->setDisplayFields(array(
'Title' => array(
'title' => 'Product',
'callback' => function($record) {
return $record->Title . ' - ' . $record->Variant;
}
),
'Price' => 'Price',
'Order.Surname' => array(
'title' => 'Customer name',
'callback' => function($record) {
$order = $record->Order();
return $order->FirstName . ' ' . $order->Surname;
}
),
'Order.Paid' => 'Order date'
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment