From 92a35354556920e6e4fd6a3eb5ed5bc84aa35f50 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Fri, 9 Mar 2012 16:48:08 +1300 Subject: [PATCH] API CHANGE: Added targetFragment argument to GridFieldExportButton to control button placement. Moved search fields to 2nd argument. --- forms/gridfield/GridFieldExportButton.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/forms/gridfield/GridFieldExportButton.php b/forms/gridfield/GridFieldExportButton.php index f853041ce..021bdecb3 100644 --- a/forms/gridfield/GridFieldExportButton.php +++ b/forms/gridfield/GridFieldExportButton.php @@ -27,11 +27,18 @@ class GridFieldExportButton implements GridField_HTMLProvider, GridField_ActionP * @var boolean */ protected $csvHasHeader = true; + + /** + * Fragment to write the button to + */ + protected $targetFragment; /** - * @param array + * @param string $targetFragment The HTML fragment to write the button into + * @param array $exportColumns The columns to include in the export */ - public function __construct($exportColumns = null) { + public function __construct($targetFragment = "after", $exportColumns = null) { + $this->targetFragment = $targetFragment; $this->exportColumns = $exportColumns; } @@ -49,7 +56,7 @@ class GridFieldExportButton implements GridField_HTMLProvider, GridField_ActionP $button->setAttribute('data-icon', 'download-csv'); $button->addExtraClass('no-ajax'); return array( - 'after' => '

' . $button->Field() . '

', + $this->targetFragment => '

' . $button->Field() . '

', ); }