protected function ViewMode::initializeIterator in Drupal 10
Same name in this branch
- 10 core/modules/node/src/Plugin/migrate/source/d6/ViewMode.php \Drupal\node\Plugin\migrate\source\d6\ViewMode::initializeIterator()
- 10 core/modules/field/src/Plugin/migrate/source/d7/ViewMode.php \Drupal\field\Plugin\migrate\source\d7\ViewMode::initializeIterator()
Same name and namespace in other branches
- 8 core/modules/field/src/Plugin/migrate/source/d7/ViewMode.php \Drupal\field\Plugin\migrate\source\d7\ViewMode::initializeIterator()
- 9 core/modules/field/src/Plugin/migrate/source/d7/ViewMode.php \Drupal\field\Plugin\migrate\source\d7\ViewMode::initializeIterator()
Initializes the iterator with the source data.
Return value
\Iterator Returns an iterable object of data for this source.
Overrides FieldInstance::initializeIterator
File
- core/
modules/ field/ src/ Plugin/ migrate/ source/ d7/ ViewMode.php, line 23
Class
- ViewMode
- Drupal 7 view mode source from database.
Namespace
Drupal\field\Plugin\migrate\source\d7Code
protected function initializeIterator() {
$instances = parent::initializeIterator();
$rows = [];
foreach ($instances
->getArrayCopy() as $instance) {
$data = unserialize($instance['data']);
foreach (array_keys($data['display']) as $view_mode) {
$key = $instance['entity_type'] . '.' . $view_mode;
$rows[$key] = array_merge($instance, [
'view_mode' => $view_mode,
]);
}
}
return new \ArrayIterator($rows);
}