Version 1
[yaffs-website] / web / core / modules / search / src / Plugin / migrate / process / d6 / SearchConfigurationRankings.php
diff --git a/web/core/modules/search/src/Plugin/migrate/process/d6/SearchConfigurationRankings.php b/web/core/modules/search/src/Plugin/migrate/process/d6/SearchConfigurationRankings.php
new file mode 100644 (file)
index 0000000..206f1f8
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+
+namespace Drupal\search\Plugin\migrate\process\d6;
+
+use Drupal\migrate\ProcessPluginBase;
+use Drupal\migrate\MigrateExecutableInterface;
+use Drupal\migrate\Row;
+
+/**
+ * Generate configuration rankings.
+ *
+ * @MigrateProcessPlugin(
+ *   id = "d6_search_configuration_rankings"
+ * )
+ */
+class SearchConfigurationRankings extends ProcessPluginBase {
+
+  /**
+   * {@inheritdoc}
+   *
+   * Generate the configuration rankings.
+   */
+  public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
+    $return = [];
+    foreach ($row->getSource() as $name => $rank) {
+      if (substr($name, 0, 10) == 'node_rank_' && $rank) {
+        $return[substr($name, 10)] = $rank;
+      }
+    }
+    return $return;
+  }
+
+}