1 | <?php |
||
7 | class GridFieldQueuedExportButton implements GridField_HTMLProvider, GridField_ActionProvider, GridField_URLHandler { |
||
|
|||
8 | |||
9 | /** |
||
10 | * @var array Map of a property name on the exported objects, with values being the column title in the CSV file. |
||
11 | * Note that titles are only used when {@link $csvHasHeader} is set to TRUE. |
||
12 | */ |
||
13 | protected $exportColumns; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $csvSeparator = ","; |
||
19 | |||
20 | /** |
||
21 | * @var boolean |
||
22 | */ |
||
23 | protected $csvHasHeader = true; |
||
24 | |||
25 | /** |
||
26 | * Fragment to write the button to |
||
27 | */ |
||
28 | protected $targetFragment; |
||
29 | |||
30 | /** |
||
31 | * @param string $targetFragment The HTML fragment to write the button into |
||
32 | * @param array $exportColumns The columns to include in the export |
||
33 | */ |
||
34 | public function __construct($targetFragment = "after", $exportColumns = null) { |
||
38 | |||
39 | /** |
||
40 | * Place the export button in a <p> tag below the field |
||
41 | */ |
||
42 | public function getHTMLFragments($gridField) { |
||
57 | |||
58 | /** |
||
59 | * This class is an action button |
||
60 | */ |
||
61 | public function getActions($gridField) { |
||
64 | |||
65 | public function handleAction(GridField $gridField, $actionName, $arguments, $data) { |
||
72 | |||
73 | function startExport($gridField) { |
||
91 | |||
92 | /** |
||
93 | * This class is also a URL handler |
||
94 | */ |
||
95 | public function getURLHandlers($gridField) { |
||
101 | |||
102 | /** |
||
103 | * Handle the export, for both the action button and the URL |
||
104 | */ |
||
105 | public function checkExport($gridField, $request = null) { |
||
145 | |||
146 | public function downloadExport($gridField, $request = null) { |
||
154 | |||
155 | /** |
||
156 | * @return array |
||
157 | */ |
||
158 | public function getExportColumns() { |
||
161 | |||
162 | /** |
||
163 | * @param array |
||
164 | */ |
||
165 | public function setExportColumns($cols) { |
||
169 | |||
170 | /** |
||
171 | * @return string |
||
172 | */ |
||
173 | public function getCsvSeparator() { |
||
176 | |||
177 | /** |
||
178 | * @param string |
||
179 | */ |
||
180 | public function setCsvSeparator($separator) { |
||
184 | |||
185 | /** |
||
186 | * @return boolean |
||
187 | */ |
||
188 | public function getCsvHasHeader() { |
||
191 | |||
192 | /** |
||
193 | * @param boolean |
||
194 | */ |
||
195 | public function setCsvHasHeader($bool) { |
||
199 | } |
||
200 | |||
217 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.