SearchConfigurationRankings.php

Same filename in this branch
  1. 8.9.x core/modules/search/src/Plugin/migrate/process/d6/SearchConfigurationRankings.php
Same filename in other branches
  1. 9 core/modules/search/src/Plugin/migrate/process/SearchConfigurationRankings.php
  2. 10 core/modules/search/src/Plugin/migrate/process/SearchConfigurationRankings.php
  3. 11.x core/modules/search/src/Plugin/migrate/process/SearchConfigurationRankings.php

Namespace

Drupal\search\Plugin\migrate\process

File

core/modules/search/src/Plugin/migrate/process/SearchConfigurationRankings.php

View source
<?php

namespace Drupal\search\Plugin\migrate\process;

use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;

/**
 * Generate configuration rankings.
 *
 * @MigrateProcessPlugin(
 *   id = "search_configuration_rankings"
 * )
 */
class SearchConfigurationRankings extends ProcessPluginBase {
    
    /**
     * {@inheritdoc}
     *
     * Generate the configuration rankings.
     */
    public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
        $return = NULL;
        foreach ($row->getSource() as $name => $rank) {
            if (substr($name, 0, 10) == 'node_rank_' && is_numeric($rank)) {
                $return[substr($name, 10)] = $rank;
            }
        }
        return $return;
    }

}

Classes

Title Deprecated Summary
SearchConfigurationRankings Generate configuration rankings.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.