Skip to content

Instantly share code, notes, and snippets.

@jitendrapurohit
Created October 21, 2023 06:49
Show Gist options
  • Save jitendrapurohit/69aed123d6b6e769367a4add23200bc5 to your computer and use it in GitHub Desktop.
Save jitendrapurohit/69aed123d6b6e769367a4add23200bc5 to your computer and use it in GitHub Desktop.
Fix required to migrate number field on d7 webform with select options.
diff --git a/src/Plugin/migrate/source/d7/D7Webform.php b/src/Plugin/migrate/source/d7/D7Webform.php
index cf58dba..00ad5c4 100644
--- a/src/Plugin/migrate/source/d7/D7Webform.php
+++ b/src/Plugin/migrate/source/d7/D7Webform.php
@@ -442,7 +442,7 @@ class D7Webform extends DrupalSqlBase implements ImportAwareInterface, RollbackA
$max = $extra['max'];
$step = !empty($extra['step']) ? $extra['step'] : 1;
for ($value = $min; $value <= $max; $value += $step) {
- $new_element[$value] = $value;
+ $new_element['#options'][$value] = $value;
}
}
foreach (['min', 'max', 'step'] as $property) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment