public function Exporter::saveFile in Loft Data Grids 7.2
Compile and and save to a filepath.
Parameters
string $directory A writable directory in which to save the file.:
null $filename:
null $page_id:
Return value
mixed
Overrides ExporterInterface::saveFile
2 methods override Exporter::saveFile()
- ArrayExporter::saveFile in vendor/
aklump/ loft_data_grids/ src/ AKlump/ LoftDataGrids/ ArrayExporter.php - Compile and and save to a filepath.
- XLSXExporter::saveFile in vendor/
aklump/ loft_data_grids/ src/ AKlump/ LoftDataGrids/ XLSXExporter.php - Compile and and save to a filepath.
File
- vendor/
aklump/ loft_data_grids/ src/ AKlump/ LoftDataGrids/ Exporter.php, line 183
Class
- Exporter
- Class Exporter
Namespace
AKlump\LoftDataGridsCode
public function saveFile($directory, $filename = null, $page_id = null) {
// Go through the setter to ensure the file_extension.
$filename = $filename ? $this
->setFilename($filename) : $this
->getFilename();
if (!is_writable($directory)) {
throw new \RuntimeException("{$directory} is not writable; cannot save {$filename}.");
}
$path = $directory . '/' . $filename;
file_put_contents($path, $this
->compile($page_id)
->export());
return $path;
}