From d7eb2757fe87e69533527e3f11d301429fb65207 Mon Sep 17 00:00:00 2001 From: Jeremy Shipman Date: Thu, 13 Nov 2014 13:48:02 +1300 Subject: [PATCH] NEW: Make the record count in GridFieldFooter optional --- forms/gridfield/GridFieldFooter.php | 5 ++++- templates/Includes/GridFieldFooter.ss | 15 ++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/forms/gridfield/GridFieldFooter.php b/forms/gridfield/GridFieldFooter.php index 8ef3d9f5a..c8e0846b6 100644 --- a/forms/gridfield/GridFieldFooter.php +++ b/forms/gridfield/GridFieldFooter.php @@ -21,15 +21,17 @@ class GridFieldFooter implements GridField_HTMLProvider { * @var string - a message to display in the footer */ protected $message = null; + protected $showrecordcount; /** * * @param string $message - a message to display in the footer */ - public function __construct($message = null) { + public function __construct($message = null, $showrecordcount = true) { if($message) { $this->message = $message; } + $this->showrecordcount = $showrecordcount; } @@ -37,6 +39,7 @@ class GridFieldFooter implements GridField_HTMLProvider { $count = $gridField->getList()->count(); $forTemplate = new ArrayData(array( + 'ShowRecordCount' => $this->showrecordcount, 'Message' => $this->message, 'FirstShownRecord' => 1, 'LastShownRecord' => $count, diff --git a/templates/Includes/GridFieldFooter.ss b/templates/Includes/GridFieldFooter.ss index 16c1dd18f..b85a70bb8 100644 --- a/templates/Includes/GridFieldFooter.ss +++ b/templates/Includes/GridFieldFooter.ss @@ -1,12 +1,13 @@ - - $FirstShownRecord - - $LastShownRecord - <% _t('TableListField_PageControls_ss.OF', 'of', 'Example: View 1 of 2') %> - $NumRecords - - + <% if $ShowRecordCount %> + + $FirstShownRecord - + $LastShownRecord + <% _t('TableListField_PageControls_ss.OF', 'of', 'Example: View 1 of 2') %> + $NumRecords + + <% end_if %> <% if $Message %> <% end_if %>