March 2019
Intermediate to advanced
580 pages
15h 3m
English
Now that our plugin configuration works—and uploaded files are properly managed and marked as used—it'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); /** ...