You are here

function simplenews_migrate_prepare_row in Simplenews 8

Same name and namespace in other branches
  1. 8.2 simplenews.module \simplenews_migrate_prepare_row()
  2. 3.x simplenews.module \simplenews_migrate_prepare_row()

Implements hook_migrate_prepare_row().

File

./simplenews.module, line 1143
Simplenews node handling, sent email, newsletter block and general hooks

Code

function simplenews_migrate_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) {
  if ($migration
    ->id() == 'd7_node_type') {
    $value = $source
      ->getDatabase()
      ->query('SELECT value FROM {variable} WHERE name = :name', [
      ':name' => 'simplenews_content_type_' . $row
        ->getSourceProperty('type'),
    ])
      ->fetchField();
    if ($value) {
      $row
        ->setSourceProperty('simplenews_content_type', unserialize($value));
    }
  }
}