/** * Handle the export, for both the action button and the URL * * @param GridField $gridField * @param HTTPRequest $request * @return HTTPResponse */ public function handleExport($gridField, $request = null) { $now = date("d-m-Y-H-i"); $fileName = "export-{$now}.csv"; if ($fileData = $this->generateExportFileData($gridField)) { return HTTPRequest::send_file($fileData, $fileName, 'text/csv'); } return null; }