Skip to Main Content
Drupal 8 Module Development - Second Edition
book

Drupal 8 Module Development - Second Edition

by Daniel Sipos
March 2019
Intermediate to advanced content levelIntermediate to advanced
580 pages
15h 3m
English
Packt Publishing
Content preview from Drupal 8 Module Development - Second Edition

Processing the CSV file

Now that our plugin configuration works—and uploaded files are properly managed and marked as usedit's time to implement the getData()method by which we process the CSV file of the Importer entity. The result needs to be an array of product information as expected by the import() method we saw earlier. So we can have something like this:

/** * Loads the product data from the remote URL. * * @return array */ private function getData() { /** @var \Drupal\products\Entity\ImporterInterface $importer_config */ $importer_config = $this->configuration['config']; $config = $importer_config->getPluginConfiguration(); $fids = isset($config['file']) ? $config['file'] : []; if (!$fids) { return NULL; } $fid = reset($fids); /** ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Drupal 8 Module Development

Drupal 8 Module Development

Daniel Sipos
Learning Drupal 8

Learning Drupal 8

Rain Michaels
Mastering Drupal 8

Mastering Drupal 8

Chaz Chumley, William Hurley

Publisher Resources

ISBN: 9781789612363Supplemental Content