October 2017
Intermediate to advanced
566 pages
14h 31m
English
Now that our plugin configuration works--and uploaded files are properly managed and marked as used--its 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 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); /** @var \Drupal\file\FileInterface ...Read now
Unlock full access