O'Reilly logo

Drupal 8 Module Development by Daniel Sipos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Importer plugin

Alright, since all of our setup is in place, we can now go ahead and create our first Importer plugin. As we defined it in the manager, these need to go in the Plugin/Importer namespace of modules. So, let's start with a simple JsonImporter that will use a remote URL resource to import products. This is an example JSON file that will be processed by this plugin, just for testing purposes:

{  "products" : [    {      "id" : 1,      "name": "TV",      "number": 341    },    {      "id" : 2,      "name": "VCR",      "number": 123    },    {      "id" : 3,      "name": "Stereo",      "number": 234    }  ]}

I know, VCR right? We have an ID, a name, and a product number. This is all totally made up information about products just to illustrate the process. So, let's create our JsonImporter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required