Security update to Drupal 8.4.6
[yaffs-website] / web / core / modules / search / src / Plugin / migrate / process / SearchConfigurationRankings.php
1 <?php
2
3 namespace Drupal\search\Plugin\migrate\process;
4
5 use Drupal\migrate\ProcessPluginBase;
6 use Drupal\migrate\MigrateExecutableInterface;
7 use Drupal\migrate\Row;
8
9 /**
10  * Generate configuration rankings.
11  *
12  * @MigrateProcessPlugin(
13  *   id = "search_configuration_rankings"
14  * )
15  */
16 class SearchConfigurationRankings extends ProcessPluginBase {
17
18   /**
19    * {@inheritdoc}
20    *
21    * Generate the configuration rankings.
22    */
23   public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
24     $return = [];
25     foreach ($row->getSource() as $name => $rank) {
26       if (substr($name, 0, 10) == 'node_rank_' && is_numeric($rank)) {
27         $return[substr($name, 10)] = $rank;
28       }
29     }
30     return $return;
31   }
32
33 }