You are here

protected function FieldInstancePerFormDisplay::initializeIterator in Zircon Profile 8

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

Implementation of MigrateSource::performRewind().

We could simply execute the query and be functionally correct, but we will take advantage of the PDO-based API to optimize the query up-front.

Overrides SqlBase::initializeIterator

File

core/modules/field/src/Plugin/migrate/source/d6/FieldInstancePerFormDisplay.php, line 25
Contains \Drupal\field\Plugin\migrate\source\d6\FieldInstancePerFormDisplay.

Class

FieldInstancePerFormDisplay
The field instance per form display source class.

Namespace

Drupal\field\Plugin\migrate\source\d6

Code

protected function initializeIterator() {
  $rows = array();
  $result = $this
    ->prepareQuery()
    ->execute();
  while ($field_row = $result
    ->fetchAssoc()) {
    $field_row['display_settings'] = unserialize($field_row['display_settings']);
    $field_row['widget_settings'] = unserialize($field_row['widget_settings']);
    $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'] = $field_row['widget_settings'];
  }
  return new \ArrayIterator($rows);
}