From b928d641ee9aa1a7c38ea2e2dee39e6dbed258f0 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 7 Mar 2013 15:32:26 +0100 Subject: [PATCH] Test dynamic summary_fields --- code/Company.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/code/Company.php b/code/Company.php index d5dcd20..8b987f9 100644 --- a/code/Company.php +++ b/code/Company.php @@ -39,7 +39,20 @@ class Company extends DataObject { 'GridFieldTestPage' => 'GridFieldTestPage' ); - public static $summary_fields = array('Name', 'Category', 'Revenue', 'CEO'); + public static $summary_fields = array( + 'Name', + 'Category', + 'Revenue', + 'CEO', + 'DynamicProperty' + ); + + public static $searchable_fields = array( + 'Name', + 'Category', + 'Revenue', + 'CEO', + ); function validate() { if(!$this->Title) { @@ -49,6 +62,10 @@ class Company extends DataObject { } } + + public function DynamicProperty() { + return sprintf('%s (%s)', $this->Name, $this->CEO); + } public function requireDefaultRecords() { parent::requireDefaultRecords();