I have these field mappings defined in my migration class

    $this->addFieldMapping('field_image', 'image_path');
    $this->addFieldMapping('field_image:source_dir')
         ->defaultValue('/var/www/test/');
    $this->addFieldMapping('field_image:alt', 'image_alt');
    $this->addFieldMapping('field_image:title', 'image_title');

and from my prepareRow function

      foreach ($image_data as $image) {
        array_push($alt, $image['alt']);
        array_push($title, $image['title']);
        array_push($path, $image['path']);
     }
    $current_row->image_alt = $alt;
    $current_row->image_title = $title;
    $current_row->image_path = $path;

All images are getting added to the files_managed table but only the first item of each array is making it in to the field_data_field_image table. Can you please explain if I am doing something incorrectly?

Comments

nhero’s picture

I figured out what the problem is. The image field needs to be set to multiple for it to be able to import multiple items.

nhero’s picture

Status: Active » Closed (fixed)