Skip to content

Instantly share code, notes, and snippets.

@bueckl
Created May 27, 2015 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bueckl/5b6e5a3d8c9cfdd2ac9f to your computer and use it in GitHub Desktop.
Save bueckl/5b6e5a3d8c9cfdd2ac9f to your computer and use it in GitHub Desktop.
SS3, Silverstripe, GridField config Field #Casting #Formating
$gridField->getConfig()->getComponentByType('GridFieldDataColumns')->setDisplayFields(array(
'Created' => 'Erstellt',
'Code' => 'Code',
'Value' => 'Wert',
'Origin' => 'Gutscheinart',
'Invoice.Buyer.FirstName' => 'Vorname',
'Invoice.Buyer.Surname' => 'Nachname',
'inUse' => 'Benutzt'
));
$gridField->getConfig()->getComponentByType('GridFieldDataColumns')->setFieldFormatting(array(
'Created' => function($val, $obj) { return $obj->dbObject('Created')->Nice(); }
));
....
or ...
$gridField->getConfig()->getComponentByType('GridFieldDataColumns')->setFieldFormatting(array(
'Created' => function($val, $obj) { return $obj->dbObject('Created')->Format('d.m.Y - h:m'); }
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment