function ViewMode::initializeIterator
Same name in this branch
- 8.9.x core/modules/field/src/Plugin/migrate/source/d7/ViewMode.php \Drupal\field\Plugin\migrate\source\d7\ViewMode::initializeIterator()
Same name in other branches
- 9 core/modules/field/src/Plugin/migrate/source/d7/ViewMode.php \Drupal\field\Plugin\migrate\source\d7\ViewMode::initializeIterator()
- 9 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()
- 10 core/modules/node/src/Plugin/migrate/source/d6/ViewMode.php \Drupal\node\Plugin\migrate\source\d6\ViewMode::initializeIterator()
- 11.x core/modules/field/src/Plugin/migrate/source/d7/ViewMode.php \Drupal\field\Plugin\migrate\source\d7\ViewMode::initializeIterator()
- 11.x core/modules/node/src/Plugin/migrate/source/d6/ViewMode.php \Drupal\node\Plugin\migrate\source\d6\ViewMode::initializeIterator()
Overrides SqlBase::initializeIterator
File
-
core/
modules/ node/ src/ Plugin/ migrate/ source/ d6/ ViewMode.php, line 18
Class
- ViewMode
- The view mode source.
Namespace
Drupal\node\Plugin\migrate\source\d6Code
protected function initializeIterator() {
$rows = [];
$result = $this->prepareQuery()
->execute();
while ($field_row = $result->fetchAssoc()) {
$field_row['display_settings'] = unserialize($field_row['display_settings']);
foreach ($this->getViewModes() as $view_mode) {
// Append to the return value if the row has display settings for this
// view mode and the view mode is neither hidden nor excluded.
// @see \Drupal\field\Plugin\migrate\source\d6\FieldInstancePerViewMode::initializeIterator()
if (isset($field_row['display_settings'][$view_mode]) && $field_row['display_settings'][$view_mode]['format'] != 'hidden' && empty($field_row['display_settings'][$view_mode]['exclude'])) {
if (!isset($rows[$view_mode])) {
$rows[$view_mode]['entity_type'] = 'node';
$rows[$view_mode]['view_mode'] = $view_mode;
}
}
}
}
return new \ArrayIterator($rows);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.