protected function ContentEntity::initializeIterator in Workbench Moderation to Content Moderation 8.2
Initializes the iterator with the source data.
Return value
\Iterator Returns an iteratable object of data for this source.
Overrides SourcePluginBase::initializeIterator
File
- src/
Plugin/ migrate/ source/ ContentEntity.php, line 96
Class
- ContentEntity
- Loads certain fields from all content entities of a specific type.
Namespace
Drupal\wbm2cm\Plugin\migrate\sourceCode
protected function initializeIterator() {
$rows = [];
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
foreach ($this
->load() as $entity) {
array_push($rows, $this
->buildRow($entity));
if ($this->configuration['include_translations']) {
$languages = array_keys($entity
->getTranslationLanguages(FALSE));
foreach ($languages as $language) {
$translation = $entity
->getTranslation($language);
array_push($rows, $this
->buildRow($translation));
}
}
}
return new \ArrayIterator($rows);
}