Permalink
Browse files

API CHANGE: Added targetFragment argument to GridFieldExportButton to…

… control button placement. Moved search fields to 2nd argument.
  • Loading branch information...
sminnee committed Mar 9, 2012
1 parent 039ba66 commit 92a35354556920e6e4fd6a3eb5ed5bc84aa35f50
Showing with 10 additions and 3 deletions.
  1. +10 −3 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 @@ public function getHTMLFragments($gridField) {
$button->setAttribute('data-icon', 'download-csv');
$button->addExtraClass('no-ajax');
return array(
- 'after' => '<p>' . $button->Field() . '</p>',
+ $this->targetFragment => '<p>' . $button->Field() . '</p>',
);
}

0 comments on commit 92a3535

Please sign in to comment.