commerce_export-8.x-1.0-alpha1/src/Plugin/migrate/process/SuggestedProducts.php

src/Plugin/migrate/process/SuggestedProducts.php
<?php

namespace Drupal\commerce_export\Plugin\migrate\process;

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

/**
 * Builds an array keyed by title for product migration lookup.
 *
 * @MigrateProcessPlugin(
 *   id = "suggested_products"
 * )
 */
class SuggestedProducts extends ProcessPluginBase {

  /**
   * {@inheritdoc}
   */
  public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    $ret = [];
    if (is_array($value)) {
      foreach ($value as $suggested) {
        if (!empty($suggested)) {
          $ret[] = [$suggested];
        }
      }
    }
    return $ret;
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc