You are here

public function SampleCsv::content in Bulk User Registration 8

Provides a response with downloadable CSV file data.

1 string reference to 'SampleCsv::content'
bulk_user_registration.routing.yml in ./bulk_user_registration.routing.yml
bulk_user_registration.routing.yml

File

src/Controller/SampleCsv.php, line 18

Class

SampleCsv
Sample CSV controller.

Namespace

Drupal\bulk_user_registration\Controller

Code

public function content() {
  $response = new Response();
  $response
    ->setContent($this
    ->getCsvData());
  $response->headers
    ->set('Content-Type', 'text/csv');
  $response->headers
    ->set('Content-Disposition', 'attachment; filename="bulk-user-registration-sample.csv"');
  return $response;
}