This patch was pretty easy to write. How's it look? [Patch attached to first comment]

#1 migrate_extras.943140.patch1.82 KBadamdicarlo
Members fund testing for the Drupal project. Drupal Association Learn more


adamdicarlo’s picture

1.82 KB
moshe weitzman’s picture

Status: Needs review » Needs work

How can this populate the title of each link. I see url but not title.

Not a big deal, but it may make sense to break these out into separate files so they match the module that defines the field.

adamdicarlo’s picture

How can this populate the title of each link.

You tell me! (Seriously, please!) I have no idea how you're supposed to go importing two source fields into one destination field, or one source field into multiple destination fields.

mikeryan’s picture

See #1004066: CCK Links migration for a link implementation that attempts to deal with the title using arguments.

Bevan’s picture

Title: Patch: Add CCK phone, email, link field support to 6.x-2.x » Support phone, email & link fields

I used this patch as a basis for a patch for Email field module to add support for Migrate: #1232028: Support for Migrate package

The only parts not covered by other issues that are mentioned here are;

  • Support for Phone fields (Phone has not yet been ported to D7 anyway)
  • Support for Drupal 6 for all of the above

I am tempted to mark this postponed or won't fix, but will leave that for the issue queue maintainer.

drewish’s picture

Title: Support phone, email & link fields » Support phone fields

So two of the three modules have been taken care of:
#1010850: Update MigrateFieldHandler to work with migrate-7.x-2.4 and later
#1232028: Support for Migrate package

Lets reign this in... That said I Really like the idea of having an abstract class that we can use to simplify a lot of these one off fields.

drewish’s picture

I took the idea of a base class from here re-rolled it as a patch against migrate: #1321062: Create a simple base class for field handlers

nerdcore’s picture

I had previously (a month or two ago) been using the following block of code to allow migrate to use Phone as a destination field:

class MigratePhoneFieldHandler extends MigrateFieldHandler {
  public function __construct() {

  public function prepare(stdClass $entity, array $field_info, array $instance, array $values) {
    // Setup the Field API array for saving.                                                                                     
    $arguments = (isset($values['arguments'])) ? $values['arguments']: array();
    $language = $this->getFieldLanguage($entity, $field_info, $arguments);
    $delta = 0;
    foreach ($values as $value) {
      $return[$language][$delta]['value'] = $value;
    return isset($return) ? $return : NULL;

But as of today that code now throws errors:

trim() expects parameter 1 to be string, array given File [DRUPAL_ROOT]/sites/all/modules/contrib/phone/phone.module, line 371

I realize the Phone field module is still listed as -dev for 7.x but this used to work and any pointers on what I could change to make it work would be much appreciated.

mikeryan’s picture

Title: Support phone fields » Support migration into phone fields
Project: Migrate Extras » Phone
Version: 6.x-2.x-dev » 7.x-1.x-dev
Component: CCK » Code

Migration support for a contrib module best goes into that module.