Information for: DEVELOPERS   PARTNERS

Importing multiple entities at once

As a content creator, you may need to import many of your publishing website’s entities to your Content Hub at once, without manually saving each of your nodes again individually in Drupal. Mass imports are possible with the creation of a custom import script. When used with the Content Hub Import Queue feature, the imported entities are processed using Drupal’s batch API, which reduces the risk of resource exhaustion on your websites.

Note

  • The example scripts included in the following procedure work only with the Drupal 8 version of Content Hub.
  • For information about batch exports (instead of imports) of entities, see Exporting multiple entities at once.

To use one of the provided import scripts, complete the following steps:

  1. In an appropriate directory, create a file named import.php.

  2. Download the following file and add the contents to the import.php file: ach-bulk-import.php

  3. Modify the code for your installation and needs, in accordance with the Notes in the comments section at the top of the file.

  4. Add the import.php file to your codebase.

  5. Enable the Content Hub Import Queue feature.

  6. Connect to your subscribing website’s server using SSH. For more information about SSH, see Managing applications using the command line.

  7. Navigate to the folder containing your import.php file, and then execute the following Drush command (where [site-uri] is your website’s URI):

    drush -l  scr import.php

Important

Acquia recommends that you use these scripts to import only independent entity types, such as nodes and taxonomy terms.

Attempting to import dependent entities, such as paragraphs, will fail due to the lack of parent entities. The example scripts specifically exclude dependent entities.