Commit 7c8934d0 authored by Gábor Hojtsy's avatar Gábor Hojtsy

Issue #3067889 by quietone: Boolean Field On and Off Label not Migrating

parent 868da6c2
......@@ -65,6 +65,16 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
$instance_settings['handler_settings'] = $field_settings['handler_settings'];
}
// Get the labels for the list_boolean type.
if ($row->getSourceProperty('type') === 'list_boolean') {
if (isset($field_data['settings']['allowed_values'][1])) {
$instance_settings['on_label'] = $field_data['settings']['allowed_values'][1];
}
if (isset($field_data['settings']['allowed_values'][0])) {
$instance_settings['off_label'] = $field_data['settings']['allowed_values'][0];
}
}
switch ($widget_type) {
case 'image_image':
$settings = $instance_settings;
......
......@@ -150,6 +150,13 @@ public function testFieldInstances() {
$this->assertNull($name_field);
$description_field = FieldConfig::load('taxonomy_term.test_vocabulary.description_field');
$this->assertNull($description_field);
$boolean_field = FieldConfig::load('node.test_content_type.field_boolean');
$expected_settings = [
'on_label' => '1',
'off_label' => 'Off',
];
$this->assertSame($expected_settings, $boolean_field->get('settings'));
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment