1

I'm currently migrating PDF files into a content type. I would like to know how to populate the file information description field with a more meaningful link (e.g. give a description to each imported file).

$arguments = MigrateFileFieldHandler::arguments(drupal_get_path('module', 'my_migrate').'/docs', 'file_copy', FILE_EXISTS_RENAME);  

$this->addFieldMapping('field_publication_download', 'files')
  ->arguments($arguments);
1

Here is a link that shows all the arguments you can pass to MigrateFileFieldHandler. As you can see description is the 7th argument.

If you don't want to specify any of the arguments before description, you still have to pass NULL to them e.g.:

$arguments = MigrateFileFieldHandler::arguments(
  drupal_get_path('module', 'my_migrate').'/docs', 
  'file_copy', 
  FILE_EXISTS_RENAME, 
  NULL, 
  NULL, 
  NULL, 
  array('source_field' => 'migrate_source_description_field'), //Can also pass a string here
);
  • Nice thanks. It was a csv migration so instead i used preparerow – rix Nov 8 '11 at 15:04
  • @rix, if this is useful to you consider marking it as an answer for the rest of the community! – Malks Feb 6 '12 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.