public function ProductTab::getYield in Commerce Migrate 3.0.x
Same name and namespace in other branches
- 8.2 modules/csv_example/src/Plugin/migrate/source/ProductTab.php \Drupal\commerce_migrate_csv_example\Plugin\migrate\source\ProductTab::getYield()
- 3.1.x modules/csv_example/src/Plugin/migrate/source/ProductTab.php \Drupal\commerce_migrate_csv_example\Plugin\migrate\source\ProductTab::getYield()
Prepares one row per tab paragraph values in the source row.
@codingStandardsIgnoreStart
@codingStandardsIgnoreEnd
Parameters
\Generator $file: The source CSV file object.
Return value
\Generator A new row, one for each filename in the source image column.
1 call to ProductTab::getYield()
- ProductTab::initializeIterator in modules/
csv_example/ src/ Plugin/ migrate/ source/ ProductTab.php
File
- modules/
csv_example/ src/ Plugin/ migrate/ source/ ProductTab.php, line 41
Class
- ProductTab
- Yields values for each product tab paragraph.
Namespace
Drupal\commerce_migrate_csv_example\Plugin\migrate\sourceCode
public function getYield(\Generator $file) {
foreach ($file as $row) {
for ($i = 1; $i < 3; $i++) {
if (!empty($row["tab_title{$i}"]) || !empty($row["tab_content{$i}"]) || !empty($row["tab_content{$i}"])) {
$new_row = $row;
$new_row['tab_title'] = trim($row["tab_title{$i}"]);
$new_row['tab_content'] = trim($row["tab_content{$i}"]);
$new_row['tab_cta'] = trim($row["tab_cta{$i}"]);
(yield $new_row);
}
}
}
}