You are here

public function TagTerm::getYield in Commerce Migrate 3.0.x

Same name and namespace in other branches
  1. 8.2 modules/woocommerce/src/Plugin/migrate/source/woo3/TagTerm.php \Drupal\commerce_migrate_woocommerce\Plugin\migrate\source\woo3\TagTerm::getYield()
  2. 3.1.x modules/woocommerce/src/Plugin/migrate/source/woo3/TagTerm.php \Drupal\commerce_migrate_woocommerce\Plugin\migrate\source\woo3\TagTerm::getYield()

Prepare one row per taxonomy term field in the source.

@codingStandardsIgnoreStart

@codingStandardsIgnoreEnd

Parameters

\Generator $file: The source CSV file object.

Return value

\Generator A new row with one taxonomy term.

1 call to TagTerm::getYield()
TagTerm::initializeIterator in modules/woocommerce/src/Plugin/migrate/source/woo3/TagTerm.php

File

modules/woocommerce/src/Plugin/migrate/source/woo3/TagTerm.php, line 47

Class

TagTerm
Yields each taxonomy term and vocabulary pair.

Namespace

Drupal\commerce_migrate_woocommerce\Plugin\migrate\source\woo3

Code

public function getYield(\Generator $file) {
  foreach ($file as $row) {
    $new_row = $row;
    $tags = explode(',', $row['Tags']);
    foreach ($tags as $tag) {
      $new_row['name'] = trim($tag);
      (yield $new_row);
    }
  }
}