Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comments
Comment #2
jhnc CreditAttribution: jhnc commentedComment #3
jhnc CreditAttribution: jhnc commented