function MigrateExternalTranslatedTestSource::initializeIterator

Same name in other branches
  1. 9 core/modules/migrate/tests/modules/migrate_external_translated_test/src/Plugin/migrate/source/MigrateExternalTranslatedTestSource.php \Drupal\migrate_external_translated_test\Plugin\migrate\source\MigrateExternalTranslatedTestSource::initializeIterator()
  2. 8.9.x core/modules/migrate/tests/modules/migrate_external_translated_test/src/Plugin/migrate/source/MigrateExternalTranslatedTestSource.php \Drupal\migrate_external_translated_test\Plugin\migrate\source\MigrateExternalTranslatedTestSource::initializeIterator()
  3. 10 core/modules/migrate/tests/modules/migrate_external_translated_test/src/Plugin/migrate/source/MigrateExternalTranslatedTestSource.php \Drupal\migrate_external_translated_test\Plugin\migrate\source\MigrateExternalTranslatedTestSource::initializeIterator()

Overrides SourcePluginBase::initializeIterator

File

core/modules/migrate/tests/modules/migrate_external_translated_test/src/Plugin/migrate/source/MigrateExternalTranslatedTestSource.php, line 65

Class

MigrateExternalTranslatedTestSource
A simple migrate source for our tests.

Namespace

Drupal\migrate_external_translated_test\Plugin\migrate\source

Code

protected function initializeIterator() {
    $data = [];
    // Keep the rows with the right languages.
    $want_default = $this->configuration['default_lang'];
    foreach ($this->import as $row) {
        $is_english = $row['lang'] == 'English';
        if ($want_default == $is_english) {
            $data[] = $row;
        }
    }
    return new \ArrayIterator($data);
}

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