You are here

protected function FieldInstancePerFormDisplay::initializeIterator in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/field/src/Plugin/migrate/source/d6/FieldInstancePerFormDisplay.php \Drupal\field\Plugin\migrate\source\d6\FieldInstancePerFormDisplay::initializeIterator()

Initializes the iterator with the source data.

Return value

\Iterator Returns an iteratable object of data for this source.

Overrides SqlBase::initializeIterator

File

core/modules/field/src/Plugin/migrate/source/d6/FieldInstancePerFormDisplay.php, line 20

Class

FieldInstancePerFormDisplay
The field instance per form display source class.

Namespace

Drupal\field\Plugin\migrate\source\d6

Code

protected function initializeIterator() {
  $rows = [];
  $result = $this
    ->prepareQuery()
    ->execute();
  while ($field_row = $result
    ->fetchAssoc()) {
    $bundle = $field_row['type_name'];
    $field_name = $field_row['field_name'];
    $index = "{$bundle}.{$field_name}";
    $rows[$index]['type_name'] = $bundle;
    $rows[$index]['widget_active'] = (bool) $field_row['widget_active'];
    $rows[$index]['field_name'] = $field_name;
    $rows[$index]['type'] = $field_row['type'];
    $rows[$index]['module'] = $field_row['module'];
    $rows[$index]['weight'] = $field_row['weight'];
    $rows[$index]['widget_type'] = $field_row['widget_type'];
    $rows[$index]['widget_settings'] = unserialize($field_row['widget_settings']);
    $rows[$index]['display_settings'] = unserialize($field_row['display_settings']);
  }
  return new \ArrayIterator($rows);
}