Update: I'm most of the way there, but my fields still aren't coming in. Here is the array I created:
I create a $row->fields_array that looks like:
[fields_array] => Array
(
[0] => Array
(
[field_doc_public] => 1
[field_testing_testing_testing] => UE2_3009.pdf
)
[1] => Array
(
[field_doc_public] => 0
[field_testing_testing_testing] => UE2_3009.doc
)
)
I really only need the field_doc_public field to be filled in, but I added field_testing_testing_testing to test as you might guess from the name. The field machine names are field_doc_public
and field_testing_testing_testing
.
The code in the actual migration looks like:
$this->addFieldMapping('field_doc_pub_files', 'file_source_file');
$this->addFieldMapping('field_doc_pub_files:file_class')
->defaultValue('MigrateEntityFileUri');
$this->addFieldMapping('field_doc_pub_files:fields', 'fields_array')
->description(t('Populate the fields.'));
$this->addFieldMapping('field_doc_pub_files:destination_dir')
->defaultValue('private://pub_docs');
$this->addFieldMapping('field_doc_pub_files:destination_file', 'file_dest_filename');
$this->addFieldMapping('field_doc_pub_files:file_replace')
->defaultValue(MigrateFileBase::FILE_EXISTS_REUSE);
$this->addFieldMapping('field_doc_pub_files:preserve_files')
->defaultValue(FALSE);
$this->addFieldMapping('field_doc_pub_files:display', file_public);
Any help on that last little push over the finish line would be greatly appreciated. (Note: no destination for the fields shows up in Migrate UI either)