Closed (fixed)
Project:
Migrate
Version:
7.x-2.4
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
28 Sep 2012 at 22:41 UTC
Updated:
1 Oct 2012 at 20:28 UTC
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
Comment #1
nhero commentedI figured out what the problem is. The image field needs to be set to multiple for it to be able to import multiple items.
Comment #2
nhero commented