public function CSVExporter::compile in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/CSVExporter.php \AKlump\LoftDataGrids\CSVExporter::compile()
Build the string content of $this->output and return $this for chaining.
Parameters
mixed $page_id: (Optional) Defaults to NULL. Set this to only compile a single page.
Return value
$this
Overrides ExporterInterface::compile
2 methods override CSVExporter::compile()
- FlatTextExporter::compile in vendor/
aklump/ loft_data_grids/ src/ AKlump/ LoftDataGrids/ FlatTextExporter.php - Build the string content of $this->output and return $this for chaining.
- HTMLExporter::compile in vendor/
aklump/ loft_data_grids/ src/ AKlump/ LoftDataGrids/ HTMLExporter.php - Build the string content of $this->output and return $this for chaining.
File
- vendor/
aklump/ loft_data_grids/ src/ AKlump/ LoftDataGrids/ CSVExporter.php, line 41
Class
- CSVExporter
- Class CSVExporter
Namespace
AKlump\LoftDataGridsCode
public function compile($page_id = null) {
$pages = $this
->getData()
->get();
if ($page_id === null && count($pages) > 1 || !array_key_exists($page_id, $pages)) {
reset($pages);
$page_id = key($pages);
}
$data = $this
->getData()
->getPage($page_id);
$this->output = '';
$this->output .= $this
->collapseRow($this
->getHeader($page_id));
// Format the rows:
foreach ($data as $row) {
$this->output .= $this
->collapseRow($row);
}
return $this;
}