Problem/Motivation

  • migrating d6 site to d8
  • old d6 content-type contains separate latitude and longitude fields
  • new d8 content-type should contain a geofield
  • geofield_latlon process plugin is supposed to enable this conversion
  • however geofield_latlon misparses its input when fed from d6_node_complete + get

Steps to reproduce

migrate_plus.migration.upgrade_d6_node_complete_club.yml contains:

# ...
class: Drupal\node\Plugin\migrate\D6NodeTranslation
field_plugin_method: null
cck_plugin_method: null
# ...
source:
  plugin: d6_node_complete
  node_type: club
# ...
process:
  # ...
  field_latitude:
    -
      plugin: get
      source: field_latitude
  field_longitude:
    -
      plugin: get
      source: field_longitude
  field_geofield:
      plugin: geofield_latlon
      source:
        - field_latitude
        - field_longitude
# ...

Add var_dump($value) before first line of transform() in web/modules/contrib/geofield/src/Plugin/migrate/process/GeofieldLatLon.php

Run drush migration:import

transform() receives values like:

array(2) {
  [0]=>
  array(1) {
    [0]=>
    array(2) {
      ["value"]=>
      string(9) "50.854334"
      ["delta"]=>
      string(1) "0"
    }
  }
  [1]=>
  array(1) {
    [0]=>
    array(2) {
      ["value"]=>
      string(9) "-0.553837"
      ["delta"]=>
      string(1) "0"
    }
  }
}

First line of transform() is: $value = array_map('floatval', $value);

This misparses the data as supplied.

Proposed resolution

Fix transform or improve documentation explaining correct use of the plugin.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

jhnc created an issue. See original summary.

jhnc’s picture

Issue summary: View changes
jhnc’s picture

Issue summary: View changes