public function CsvController::files in Feeds 8.3
Outputs a CSV file pointing to files.
Return value
\Symfony\Component\HttpFoundation\Response A HTTP response.
1 string reference to 'CsvController::files'
- feeds_test_files.routing.yml in tests/
modules/ feeds_test_files/ feeds_test_files.routing.yml - tests/modules/feeds_test_files/feeds_test_files.routing.yml
File
- tests/
modules/ feeds_test_files/ src/ Controller/ CsvController.php, line 43
Class
- CsvController
- Generates CSV source files.
Namespace
Drupal\feeds_test_files\ControllerCode
public function files() {
$assets_url = $this
->getResourcesUrl() . '/assets';
$csv_lines = [
[
'title',
'timestamp',
'file',
],
[
'Tubing is awesome',
'205200720',
$assets_url . '/tubing.jpeg',
],
[
'Jeff vs Tom',
'428112720',
$assets_url . '/foosball.jpeg?10000',
],
[
'Attersee',
'1151766000',
$assets_url . '/attersee.jpeg',
],
[
'H Street NE',
'1256326995',
$assets_url . '/hstreet.jpeg',
],
[
'La Fayette Park',
'1256326995',
$assets_url . '/la fayette.jpeg',
],
[
'Attersee 2',
'1151766000',
$assets_url . '/attersee.JPG',
],
];
$csv = '';
foreach ($csv_lines as $line) {
$csv .= implode(',', $line) . "\n";
}
$response = new Response();
$response
->setContent($csv);
return $response;
}